Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
adjisb opened this issue Feb 17, 2023 · 2 comments

Comments

@adjisb
Copy link

adjisb commented Feb 17, 2023

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)
@dbale-altoros
Copy link
Collaborator

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

@adjisb
Copy link
Author

adjisb commented Feb 22, 2023

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

@adjisb adjisb closed this as completed Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants