todogroup / repolinter

Repolinter, The Open Source Repository Linter
https://todogroup.github.io/repolinter/
Apache License 2.0
428 stars 74 forks source link

Exit code is not set correctly when there are errors #94

Closed markbirbeck closed 6 years ago

markbirbeck commented 6 years ago

When using repolinter in a CI/CD system or in Docker, the exit code is not set correctly to reflect failing rules. For example, this:

repolinter || echo 'error'

never writes 'error'.

markbirbeck commented 6 years ago

There are two problems. The first is that the anyFailures variable is being overwritten by the state of the latest bunch of rules tested--i.e., a failure early on will be overwritten by success later.

The second problem is that the way that anyFailures is worked out is based on looking at the level of the rule (it should be 'error') but the test is on result.level rather than result.rule.level.

markbirbeck commented 6 years ago

I've addressed both of the issues and submitted a pull request:

https://github.com/todogroup/repolinter/pull/96

markbirbeck commented 6 years ago

Thanks for merge.