GithubHelp home page GithubHelp logo

Add linter about aragonos HOT 8 CLOSED

aragon avatar aragon commented on August 15, 2024
Add linter

from aragonos.

Comments (8)

Quazia avatar Quazia commented on August 15, 2024

Are there any custom rules or are the standard rules okay for this? Also should a linter be added for non-solidity files and if so should the two linters be run through the same script (run lint) or separate scripts(run lint, run solium)?

Is changing the errors flagged through linting included in this issue?

from aragonos.

izqui avatar izqui commented on August 15, 2024

I'd say to focus on Solidity linting first. The standard rules would be a good point to start.

Maybe we could add JS linting for the test files after

from aragonos.

Quazia avatar Quazia commented on August 15, 2024

Alright, I added the solidity linting and got about 90 errors and 500 warnings. I'm totally down to make the changes to pass the linter but don't want to go ahead on that if there are standards that you downright disagree with. I started fixing things that look like outright errors ( " 1 -1" vs " 1 - 1 ") but I'm leaving alone things that appear to be preferences ( opening brace on new line for functions with a returns statement in the function decleration for example ). Also it looks like Solium is throwing errors unrelated to the aragon-core code base. Once I get the warnings down I'll take a look into that and see if that's something that's easily resolved. I pushed just adding Solium which was very straight forward so let me know if you want me to put in a PR for just that, otherwise I'll wait until I clean some of these errors and put a PR in then.

from aragonos.

onbjerg avatar onbjerg commented on August 15, 2024

@Quazia I think it would be neat if you opened to PR even if it's a work in progress. I'd like to know what sort of errors are thrown; could you perhaps include some examples?

from aragonos.

Quazia avatar Quazia commented on August 15, 2024

Yeah sure,

        if (!holder.send(returningMoney))  throw;
                                           ^-- ERROR: Consequent should exist exactly on the line after condition.

These errors are pretty common, this and the 4 space tabs over 2 space tabs are probably two of the most common

    function BoundedStandardSale(address _daoAddress, uint8 _tokenId, uint256 _min, uint256 _max, uint256 _price, uint64 _closeDate, string _title) {
    ^-- WARNING: Function 'BoundedStandardSale': in case of more than 3 parameters, drop each into its own line.

This is one that I think makes sense. I think it's a lot easier to read when they're dropped down.

In /home/quazia/Sites/quazia/aragon-core/contracts/kernel/organs/VaultOrgan.sol, line 321:
    modifier check_blacklist(address _token) {
    ^-- WARNING: 'check_blacklist' doesn't follow the mixedCase notation

I haven't been resolving the mixedCase notation where it's a function name as I don't want to create a breaking change elsewhere. I don't know if the smart solution to this would be to allow snake_case in the linter or to just standardize to mixedCase.

            (sig == GET_TOKEN_BALANCE_SIG)||
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.
             ^-- ERROR: There should be no comments between right side and '||'.

I'm having difficulty resolving this one in a way that only changes syntax so I moved past it for the time being, the same error is thrown in all of the canHandlePayload functions across the Organ contracts. In addition, some of the canHandlePayload functions are causing the parser to crash but I've found just adding parentheses seems to resolve the parser errors.

48 errors, 211 warnings found.

I've gotten about half of the errors/warnings handled but I'm sure that as I fix the parser errors more will pop up.

I have a txt file of the lint output if you'd like to take a look and I'm going to put a PR in as a WIP as requested. I'd say the vast majority of warnings and errors fit into one of the categories above.

from aragonos.

Quazia avatar Quazia commented on August 15, 2024

Currently there is a parser error for some of the assembly blocks for example:

solidity-parser ./contracts/kernel/organs/ApplicationOrgan.sol 
Expected "=:", "hex", "let", "{", "}", comment, end of line, number, string, or whitespace but "r" found. Line: 33, Column: 13

This is due to the following issue in ConsenSys/solidity-parser
"Missing assembly rules: for, switch, function #83"

The parsing issue presents in multiple contracts when a return statement is used in an assembly block.

Going to proceed for the time being and if needed maybe try and resolve this issue in the solidity-parser

from aragonos.

izqui avatar izqui commented on August 15, 2024

Awesome! Btw, just a heads up, old-contracts is going to be deleted from the repo, it is just there as a quickly accessible reference

from aragonos.

onbjerg avatar onbjerg commented on August 15, 2024

Linter added in #59.

from aragonos.

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.