duaraghav8 / Ethlint

(Formerly Solium) Code quality & Security Linter for Solidity
https://ethlint.readthedocs.io/en/latest/
MIT License
927 stars 128 forks source link

max-len rule doesn't apply in certain cases #272

Open BrendanChou opened 5 years ago

BrendanChou commented 5 years ago

Description The max-len rule doesn't catch too-long lines in some cases. Notably, it seems to only check the first line of a statement, not any other lines of a multi-line statement.

Steps to reproduce This section may contain all or a combination of the following: .soliumrc.json

{
  "extends": "solium:all",
  "plugins": ["security"],
  "rules": {
    "operator-whitespace": 0,
    "mixedcase": 0,
    "no-experimental": 0,
    "lbrace": 0,
    "max-len": ["error", 100],
    "indentation": ["error", 4],
    "quotes": ["error", "double"],
    "arg-overflow": ["warning", 3],
    "error-reason": ["error"],
    "visibility-first": ["error"],
    "linebreak-style": ["error", "unix"],
    "security/enforce-explicit-visibility": ["error"],
    "security/no-block-members": 0,
    "security/no-named-returns": ["error"],
    "security/no-suicide-or-selfdestruct": ["error"],
    "security/no-var": ["error"]
  }
}

Solidity:

Require.that(
    data.length >= NUM_ORDER_BYTES + 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100+ 100 + NUM_SIGNATURE_BYTES,
    FILE,
    "Cannot parse signature from data"
);

Expected behavior Have tested in similar scenarios, it seems that max-len only checks the line length of the first line of the statement (The one with Require.that()

Operating System Mac OS

Linter version 1.2.4

duaraghav8 commented 5 years ago

@BrendanChou thanks for reporting, I can confirm that this is an issue in the lint rule itself, so you can expect to face the same regardless of your OS. Added to v1.2.5 todo