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

Linter doesn't return non-zero code when --fix-dry-run fixes errors #258

Open
duaraghav8 opened this issue Feb 2, 2019 · 2 comments
Open
Labels

Comments

@duaraghav8
Copy link
Owner

Description
If --fix-dry-run fixes all the lint errors in the code, the linter exits with 0. This is wrong behaviour because dry run doesn't permanently fix those errors in the code, so linter should still consider them when exiting with a code.

Steps to reproduce
For the sake of simplicity, sample.sol should contain 1 fixable lint issue (eg- quotes-related issue). .soliumrc.json should mark this issue's rule as an error.

Run solium -f sample.sol --fix-dry-run

Then check the exit code in bash echo $?
Output: 0

Expected behavior
Exit code should be > 0 because the error still exists in the code.

Operating System
Platform-independent

Linter version
1.2.2

Comments
This issue was discovered while working on #255

Resolving this in a patch/minor release will be a breaking change for anyone using --fix-dry-run in their builds (any environment where the exit code has an impact on outcome) when they update the linter.

But since the fix-related options are primarily used during local development, I don't think this would impact a lot of users.

Issue is open for discussion on whether we should fix this in a patch/minor release or not.

Priority
High

@duaraghav8 duaraghav8 added the bug label Feb 2, 2019
@Aniket-Engg
Copy link

Aniket-Engg commented Feb 22, 2019

for me, echo $? returns 1 when I have 10+ errors & warnings.

@duaraghav8
Copy link
Owner Author

if you eliminate all errors (either using the fixer or simply removing them from soliumrc), it will return 0 which it shouldn't because errors are still there (fix-dry-run simply removes them in-memory, not permanently)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants