diff --git a/remix-analyzer/src/solidity-analyzer/modules/guardConditions.ts b/remix-analyzer/src/solidity-analyzer/modules/guardConditions.ts index 2551835ae1..52982117d1 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/guardConditions.ts +++ b/remix-analyzer/src/solidity-analyzer/modules/guardConditions.ts @@ -15,12 +15,12 @@ export default class guardConditions implements AnalyzerModule { } report (compilationResults: CompilationResult): ReportObj[] { - if (this.guards.length > 0) { - return [{ - warning: 'Use assert(x) if you never ever want x to be false, not in any circumstance (apart from a bug in your code). Use require(x) if x can be false, due to e.g. invalid input or a failing external component.', + return this.guards.map((node) => { + return { + warning: `Use 'assert(x)' if you never ever want x to be false, not in any circumstance (apart from a bug in your code). Use 'require(x)' if x can be false, due to e.g. invalid input or a failing external component.`, + location: node.src, more: 'http://solidity.readthedocs.io/en/develop/control-structures.html#error-handling-assert-require-revert-and-exceptions' - }] - } - return [] + } + }) } } diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts index 5c09486af3..1d465a08c6 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts @@ -486,7 +486,7 @@ test('Integration test guardConditions module', function (t: test.Test) { const module: any = modules.guardConditions const lengthCheck: Record = { 'KingOfTheEtherThrone.sol': 0, - 'assembly.sol': 1, + 'assembly.sol': 2, 'ballot.sol': 0, 'ballot_reentrant.sol': 0, 'ballot_withoutWarnings.sol': 0, diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts index 615674e6a2..6ffd646b4c 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts @@ -448,7 +448,7 @@ test('Integration test guardConditions module', function (t: test.Test) { const module: any = modules.guardConditions const lengthCheck: Record = { 'KingOfTheEtherThrone.sol': 0, - 'assembly.sol': 1, + 'assembly.sol': 2, 'ballot.sol': 0, 'ballot_reentrant.sol': 0, 'ballot_withoutWarnings.sol': 0,