NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.16k stars 1.37k forks source link

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

Closed codekoriko closed 1 month ago

codekoriko commented 5 months ago

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

kanej commented 5 months ago

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

madlabman commented 5 months ago

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

madlabman commented 5 months ago

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

kanej commented 5 months ago

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

AlissonRS commented 1 month ago

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

kanej commented 1 month ago

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

galargh commented 1 month ago

Thanks for the report! This issue has now been fixed in the release @nomiclabs/hardhat-solhint@4.0.0