protofire/solhint

Error when running with --max-warnings and wrong file pattern that matches zero files

adjisb opened this issue · 2 comments

When running with --max-warnings 1 and the file pattern end up matching zero files the following error happen:

TypeError: Cannot read properties of undefined (reading 'errorCount')

To reproduce run:
npx solhint --max-warnings 0 nonexistentfile.sol

contracts/node_modules/solhint/solhint.js:97
    if (program.maxWarnings && !reports[0].errorCount && warningsNumberExceeded) {
                                           ^

TypeError: Cannot read properties of undefined (reading 'errorCount')
    at Command.execMainAction (contracts/node_modules/solhint/solhint.js:97:44)
    at Command.listener (contracts/node_modules/commander/index.js:315:8)
    at Command.emit (node:events:513:28)
    at Command.parseArgs (contracts/node_modules/commander/index.js:656:12)
    at Command.parse (contracts/node_modules/commander/index.js:474:21)
    at init (contracts/node_modules/solhint/solhint.js:42:11)
    at Object.<anonymous> (contracts/node_modules/solhint/solhint.js:209:1)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)

@adjisb
Did you try this with the last version 3.4.0 ?
Because as I recall this was fixed with this PR
#351

You are right, it is version 3.3.8.
Sorry for the noise.