mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Fix #4499 - Fix solhint >= 3.4.0
Fix solhint for versions >= 3.4.0, while still supporting older versions. The solhint linter code has been moved out of the `handlers` directory as it does not need to be shared between different filetypes. Code has been simplified. Co-authored-by: Henrique Barcelos <16565602+hbarcelos@users.noreply.github.com>
This commit is contained in:
@@ -50,16 +50,15 @@ Execute(The solhint handler should parse linter error messages correctly):
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#solhint#Handle(bufnr(''), [
|
||||
\ 'contracts/Bounty.sol: line 1, col 17, Warning - Compiler version must be fixed (compiler-fixed)',
|
||||
\ 'contracts/Bounty.sol: line 4, col 8, Error - Use double quotes for string literals (quotes)',
|
||||
\ 'contracts/Bounty.sol: line 5, col 8, Error - Use double quotes for string literals (quotes)',
|
||||
\ 'contracts/Bounty.sol: line 13, col 3, Error - Expected indentation of 4 spaces but found 2 (indent)',
|
||||
\ 'contracts/Bounty.sol: line 14, col 3, Error - Expected indentation of 4 spaces but found 2 (indent)',
|
||||
\ 'contracts/Bounty.sol: line 47, col 3, Error - Function order is incorrect, public function can not go after internal function. (func-order)',
|
||||
\ ale_linters#solidity#solhint#Handle(bufnr(''), [
|
||||
\ 'contracts/Bounty.sol:1:17: Compiler version must be fixed [Warning/compiler-fixed]',
|
||||
\ 'contracts/Bounty.sol:4:8: Use double quotes for string literals [Error/quotes]',
|
||||
\ 'contracts/Bounty.sol:5:8: Use double quotes for string literals [Error/quotes]',
|
||||
\ 'contracts/Bounty.sol:13:3: Expected indentation of 4 spaces but found 2 [Error/indent]',
|
||||
\ 'contracts/Bounty.sol:14:3: Expected indentation of 4 spaces but found 2 [Error/indent]',
|
||||
\ 'contracts/Bounty.sol:47:3: Function order is incorrect, public function can not go after internal function. [Error/func-order]',
|
||||
\ ])
|
||||
|
||||
|
||||
Execute(The solhint handler should parse syntax error messages correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
@@ -78,7 +77,7 @@ Execute(The solhint handler should parse syntax error messages correctly):
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#solhint#Handle(bufnr(''), [
|
||||
\ "contracts/Bounty.sol: line 30, col 4, Error - Parse error: missing ';' at 'uint248'",
|
||||
\ "contracts/Bounty.sol: line 203, col 4, Error - Parse error: no viable alternative at input '_loserStakeMultiplier}'",
|
||||
\ ale_linters#solidity#solhint#Handle(bufnr(''), [
|
||||
\ "contracts/Bounty.sol:30:4: Parse error: missing ';' at 'uint248' [Error]",
|
||||
\ "contracts/Bounty.sol:203:4: Parse error: no viable alternative at input '_loserStakeMultiplier}' [Error]",
|
||||
\ ])
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('solidity', 'solhint')
|
||||
runtime autoload/ale/handlers/solhint.vim
|
||||
|
||||
let b:args = ' --formatter compact %s'
|
||||
let b:args = ' --formatter unix %s'
|
||||
|
||||
After:
|
||||
unlet! b:args
|
||||
@@ -18,7 +17,6 @@ Execute(The options should be configurable):
|
||||
|
||||
AssertLinter 'solhint', ale#Escape('solhint') . ' --foobar' . b:args
|
||||
|
||||
|
||||
Execute(solhint should be run from a containing project with solhint executable):
|
||||
call ale#test#SetFilename('../test-files/solhint/Contract.sol')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user