protofire / solhint

Solhint is an open-source project to provide a linting utility for Solidity code.
https://protofire.github.io/solhint/
MIT License
1.04k stars 160 forks source link

virtual modifier is not supported #281

Closed hellwolf closed 1 year ago

hellwolf commented 3 years ago

Solidity code:

    //solhint-disable-next-line
    modifier onlyAuthorized(ISuperfluid host) virtual;

solhint output:

contracts/gov/SuperfluidGovernanceBase.sol
  266:53  error  Parse error: extraneous input ';' expecting {'{', 'override', 'virtual'}
  268:0   error  Parse error: extraneous input '<EOF>' expecting {'from', '}', 'using', 'struct', 'modifier', 'function', 'function', 'event', 'enum', 'address', 'mapping', 'calldata', 'var', 'bool', 'string', 'byte', 'callback', Int, Uint, Byte, Fixed, Ufixed, 'leave', 'payable', 'constructor', 'fallback', 'receive', 'receive', Identifier}
fvictorio commented 3 years ago

Thanks for reporting this @hellwolf.

This depends on https://github.com/solidity-parser/parser/issues/43

patrickd- commented 2 years ago

Ran into same issue in a Linting CI pipeline: https://github.com/patrickd-/cheatsheet.sol/runs/4956891444?check_suite_focus=true

Affected line: https://github.com/patrickd-/cheatsheet.sol/blob/6597c1d315a4bd3e940024e0d45ee12e0bf6e2a5/contracts/cheatsheet.sol#L57


Forked solhint and bumped @solidity-parser/parser to 0.14.0

Here: https://github.com/patrickd-/solhint/tree/patch-1


Changed dependency to that fork: https://github.com/patrickd-/cheatsheet.sol/commit/c16cb05fb760845719f094326c8b6eecb67e542f

Linter now succeeeds: https://github.com/patrickd-/cheatsheet.sol/runs/4980165010?check_suite_focus=true


Created MR https://github.com/protofire/solhint/pull/326

dbale-altoros commented 1 year ago

This issue is fixed when upgrading to the last solidity parser version (0.14.5) https://github.com/protofire/solhint/pull/378