hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

npx hardhat run check: raise error, exit code stays 0

Open codekoriko opened this issue 1 year ago • 4 comments

Version of Hardhat

2.22.2

What happened?

I'm using the hardhat-solhint plugin, when the litting process raise error, the exit code stays the 0, therefor command chaining with && don't break, which is a problem

Minimal reproduction steps

Running the linter as mentioned in the doc:

npx hardhat check && echo 'Error Code: '$? 

An error arise during the linting but Exit Code stays 0

    8:1  error    Unexpected import of console file
             no-console
    8:1  warning  global import of path hardhat/console.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
             no-global-import
   31:5  warning  Explicitly mark visibility in function (Set ignoreConstructors to true if using solidity >=0.7.0)
             func-visibility
   56:9  warning  Use Custom Errors instead of require statements
             custom-errors
   74:9  warning  Use Custom Errors instead of require statements
             custom-errors
   76:9  warning  Use Custom Errors instead of require statements
             custom-errors
   94:9  warning  Use Custom Errors instead of require statements
             custom-errors
  114:9  warning  Use Custom Errors instead of require statements
             custom-errors

✖ 40 problems (1 error, 39 warnings)

Error Code: 0

Search terms

No response

codekoriko avatar Apr 02 '24 09:04 codekoriko

I was able to reproduce this locally, by taking a new typescript sample project, adding the solhint plugin, running solhint --init and updating the config to:

{
  "extends": "solhint:recommended"
}

On running npx hardhat check we don't get a non-zero exit code:

image

kanej avatar Apr 02 '24 09:04 kanej

Because of this I think https://github.com/protofire/solhint/pull/554

madlabman avatar Apr 08 '24 15:04 madlabman

Opened the issue https://github.com/protofire/solhint/issues/572

madlabman avatar Apr 09 '24 13:04 madlabman

Thanks @madlabman, we will keep this open to track the issue coming in on the hardhat-solhint plugin.

kanej avatar Apr 10 '24 14:04 kanej

@kanej just a heads up this was fixed in Solhint 5.0.1 :rocket:

AlissonRS avatar Jul 18 '24 15:07 AlissonRS

Just note that upgrading to Solhint 5.0.1 would equate to a major version bump in the hardhat-solhint plugin.

kanej avatar Jul 26 '24 14:07 kanej

Thanks for the report! This issue has now been fixed in the release @nomiclabs/[email protected]

galargh avatar Aug 01 '24 09:08 galargh