Comments (5)
This is a minimal failing example:
pragma solidity ^0.4.4;
contract A {
function A() {
if (1 && 1 && 1) {
}
}
}
Apparently the three combined conditions are what trigger the bug. Removing the last && 1
allows solium to run normally.
from ethlint.
After a bit more debugging the root of the problem lies in operator-whitespace.js
L21-24
BinaryExpression
s with more than two operands get parsed into a tree where the left
node is itself a BinaryExpression
. This leads to getStringBetweenNodes()
returning an empty string which then breaks in L24.
However I'm not quite sure what the fix should be.
from ethlint.
@ulope correct! I'm tracking this through tests (if you run npm test
, you will see 2 operator-whitespace tests failing). To be honest, I myself haven't thought of a solution to this :P
Hopefully, I'll find time to fix this soon!
from ethlint.
For now I'm using this truly horrendous brute force hack to work around it. This breaks whitespace violations detection in > 2 operator expressions in some cases but at least avoids the crash.
sed -i '/var strBetweenLeftAndRight/i \
if (node.left.type == "BinaryExpression") { return; }' $(npm root --global)/solium/lib/rules/operator-whitespace.js
from ethlint.
solved in v0.2.2, thanks to @kenji-isuntv @ulope @cgewecke
Hopefully it wouldn't pose any more problems (feel free to re-open the issue otherwise)
Will keep testing the fix
from ethlint.
Related Issues (20)
- max-len rule doesn't apply in certain cases HOT 1
- no-empty-blocks shouldn't flag empty contract body in an inherited contract
- CLI: add option to list all available lint rules
- Update security rules to follow new best practices for transferring value HOT 3
- Wrong indentation on ternary operator parentheses
- Linter complains on assembly for loop syntax
- --fix flag does not fix HOT 2
- “Consider using 'transfer' in place of 'call.value()” is a false error message HOT 1
- Support abstract contracts. HOT 5
- ethlint dependecies secuirty issues
- Syntax error when using array slice on a bytes datatype HOT 1
- Wrong error message for `msg.sender.call{value: amount}("");`
- .soliumignore doesn't ignore files/dirs listed
- yarn audit fail: 4 vulnerabilities found
- Multi-literal strings support
- Linter complain on try/catch syntax
- Linter complain on syntax to call `create2`
- False positive on interface inheriting from another interface
- Feature Request: no-unused-imports
- npm install -g solium
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ethlint.