Giter VIP home page Giter VIP logo

Comments (5)

ulope avatar ulope commented on September 1, 2024 1

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.

ulope avatar ulope commented on September 1, 2024

After a bit more debugging the root of the problem lies in operator-whitespace.js L21-24

BinaryExpressions 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.

duaraghav8 avatar duaraghav8 commented on September 1, 2024

@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.

ulope avatar ulope commented on September 1, 2024

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.

duaraghav8 avatar duaraghav8 commented on September 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.