noveogroup / android-check

Static code analysis plugin for Android project. (Checkstyle, PMD)
Other
268 stars 67 forks source link

Added ability to specify threshold. Task will throw an exception if t… #36

Open JoshuaJamesOng opened 7 years ago

JoshuaJamesOng commented 7 years ago

…hreshold breached. Default of -1 means threshold disabled.

JoshuaJamesOng commented 7 years ago

@smalichenko I believe you're the core maintainer now, can you please review this PR?

Use Case: Introducing static analysis into existing legacy projects where continuous integration server does not support threshold plugin e.g. BitBucket/GitLab. These projects will have a large number of pre-existing issues that will take time to resolve. In the mean time, new code should be subject to analysis and builds should fail when new issues are introduced.

Implementation Choices The value defaults to -1 which will disable this check on a per tool basis, as users of e.g. Jenkins will not require and it would be unfair to force them to maintain this value. If 0 or greater is entered as a value, and the report contains and error count greater than the threshold, then the same exception as abortOnError will be thrown - causing CI systems to fail the build. The value is exclusive, so that if the existing project reports 100 issues then an exception should not be thrown until the threshold (100) is broken