Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior of indentation rule for abstract functions #268

Open
quezak opened this issue Jul 1, 2019 · 4 comments
Open

Inconsistent behavior of indentation rule for abstract functions #268

quezak opened this issue Jul 1, 2019 · 4 comments
Labels
bug Hacktoberfest Hacktoberfest 2019

Comments

@quezak
Copy link

quezak commented Jul 1, 2019

Description
Indentation for functions with a long, multiline argument list behaves differently for abstract and concrete functions -- see example. The error message is also weird, as it says to use 4 spaces (== 1 indent in my case), when the line already uses 4 spaces, and the error disappears if I use a double indent there (which is 8 spaces).

Steps to reproduce

  • The command you used to lint: npx solium --file test.sol
  • The solidity code over which you ran the linter
pragma solidity 0.5.10;

contract Test {
    function concreteFn(
        uint256 _long,
        uint256 _arg,
        uint256 _list
    ) internal returns (bool success) {
        return true;
    }

    function abstractFn(
        uint256 _long,
        uint256 _arg,
        uint256 _list
    ) internal returns (bool success);
    // ^ this yields: error    Only use indent of 4 spaces.
    // also: the line already uses 4 spaces indent!

    function abstractFn2(
        uint256 _long,
        uint256 _arg,
        uint256 _list
        ) internal returns (bool success);
    // ^ this doesn't, but is inconsistent with concreteFn [and ugly ;) ]
}
  • Contents of your .soliumrc.json file
{
  "extends": "solium:recommended",
  "plugins": ["security"],
  "rules": {
    "indentation": ["error", 4]
  }
}
  • Contents of your .soliumignore: node_modules

Expected behavior
abstractFn shouldn't yield errors, as it's formatted consistently with concreteFn

Operating System
Linux

Linter version
Solium version 1.2.4

@quezak quezak added the bug label Jul 1, 2019
@duaraghav8
Copy link
Owner

I'm able to reproduce this, thanks for reporting

@duaraghav8 duaraghav8 mentioned this issue Jul 1, 2019
7 tasks
@duaraghav8 duaraghav8 added the Hacktoberfest Hacktoberfest 2019 label Oct 1, 2019
@nfurfaro
Copy link

Hey, any progress on this? I've modified the indentation of my closong parens on all my abstract functions as a workaround... but would be great if this wasn't an issue.

@duaraghav8
Copy link
Owner

@nfurfaro This is one of the issues I've been working on (https://github.com/duaraghav8/Ethlint/projects/6) but I recently hit a roadblock. It may be around for 2-3 months. I see that you've had to change your indent style. If comment directives work for you instead of changing your code, I recommend using them to ignore indent lint issues.

@nfurfaro
Copy link

nfurfaro commented Nov 30, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Hacktoberfest Hacktoberfest 2019
Projects
None yet
Development

No branches or pull requests

3 participants