Commit a2d85a9c authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #883 from ethereum/fixAnalysis

Fix static analysis report && add test
parents 2f7d78ed 585c8b3a
...@@ -29,11 +29,11 @@ function report (contracts, multipleContractsWithSameName) { ...@@ -29,11 +29,11 @@ function report (contracts, multipleContractsWithSameName) {
var funcName = common.getFullQuallyfiedFuncDefinitionIdent(contract.node, func.node, func.parameters) var funcName = common.getFullQuallyfiedFuncDefinitionIdent(contract.node, func.node, func.parameters)
var hasModifiersComments = '' var hasModifiersComments = ''
if (hasModifiers) { if (hasModifiers) {
hasModifiersComments = yo`<span><br/><i>Note:</i> Modifiers are currently not considered by this static analysis.</span>` hasModifiersComments = yo`<span><br><i>Note:</i> Modifiers are currently not considered by this static analysis.</span>`
} }
var multipleContractsWithSameNameComments = '' var multipleContractsWithSameNameComments = ''
if (multipleContractsWithSameName) { if (multipleContractsWithSameName) {
multipleContractsWithSameNameComments = yo`<span><br/><i>Note:</i> Import aliases are currently not supported by this static analysis.</span>` multipleContractsWithSameNameComments = yo`<span><br><i>Note:</i> Import aliases are currently not supported by this static analysis.</span>`
} }
var vars = getFunctionVariables(contract, func).map(common.getDeclaredVariableName) var vars = getFunctionVariables(contract, func).map(common.getDeclaredVariableName)
......
...@@ -11,7 +11,11 @@ contract test1 { address test = tx.origin; } ...@@ -11,7 +11,11 @@ contract test1 { address test = tx.origin; }
contract test2 {} contract test2 {}
contract TooMuchGas { contract TooMuchGas {
uint x; uint x;
function() { x++; } function() {
x++;
uint test;
uint test1;
}
}`} }`}
] ]
...@@ -38,7 +42,8 @@ function runTests (browser) { ...@@ -38,7 +42,8 @@ function runTests (browser) {
.click('#staticanalysisView button') .click('#staticanalysisView button')
.waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () { .waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () {
dom.listSelectorContains(['browser/Untitled.sol:2:33: Use of tx.origin', dom.listSelectorContains(['browser/Untitled.sol:2:33: Use of tx.origin',
'Fallback function of contract browser/Untitled.sol:TooMuchGas requires too much gas'], 'Fallback function of contract browser/Untitled.sol:TooMuchGas requires too much gas',
'TooMuchGas.(): Variables have very similar names test and test1.'],
'#staticanalysisresult .warning', '#staticanalysisresult .warning',
browser, function () { browser, function () {
browser.end() browser.end()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment