Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into spotbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-archano committed Oct 29, 2019
2 parents 48d8178 + 848237d commit 78c3a5f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,14 @@
Change Log
==========

[Version 1.1](https://github.com/novoda/gradle-static-analysis-plugin/releases/tag/v1.1)
--------------------------

- Add support for Ktlint Plugin: `9.0.0`. Thanks [Adam McNeilly](https://github.com/AdamMc331) for the contribution [PR#202](https://github.com/novoda/gradle-static-analysis-plugin/pull/202)
- Update project to use Gradle 5.6.3. [PR#203](https://github.com/novoda/gradle-static-analysis-plugin/pull/203)
- Note: Minimum supported Gradle version is still 4.x (tested with 4.3.1)
- Update docs [PR#194](https://github.com/novoda/gradle-static-analysis-plugin/pull/194)

[Version 1.0](https://github.com/novoda/gradle-static-analysis-plugin/releases/tag/v1.0)
--------------------------
Expand Down
17 changes: 8 additions & 9 deletions README.md
@@ -1,5 +1,5 @@
# Gradle static analysis plugin
[![](https://ci.novoda.com/buildStatus/icon?job=gradle-static-analysis-plugin)](https://ci.novoda.com/job/gradle-static-analysis-plugin/lastSuccessfulBuild) [![](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](LICENSE.txt) [![Bintray](https://api.bintray.com/packages/novoda/maven/gradle-static-analysis-plugin/images/download.svg)](https://bintray.com/novoda-oss/maven/gradle-static-analysis-plugin/_latestVersion)
[![](https://ci.novoda.com/buildStatus/icon?job=gradle-static-analysis-plugin)](https://ci.novoda.com/job/gradle-static-analysis-plugin/lastSuccessfulBuild) [![](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](LICENSE.txt) [![Bintray](https://api.bintray.com/packages/novoda-oss/maven/gradle-static-analysis-plugin/images/download.svg)](https://bintray.com/novoda-oss/maven/gradle-static-analysis-plugin/_latestVersion)

A Gradle plugin to easily apply the same setup of static analysis tools across different Android, Java or Kotlin projects.

Expand Down Expand Up @@ -32,7 +32,7 @@ Please note that the tools availability depends on the project the plugin is app

### Tools in-consideration
* `CPD (Duplicate Code Detection) ` [#150](https://github.com/novoda/gradle-static-analysis-plugin/iss (Duplicate Code Detection) ues/150)
* `CPD (Duplicate Code Detection) ` [#150](https://github.com/novoda/gradle-static-analysis-plugin/issues/150)
* `error-prone` [#151](https://github.com/novoda/gradle-static-analysis-plugin/issues/151)
* `Jetbrains IDEA Inspections` [#152](https://github.com/novoda/gradle-static-analysis-plugin/issues/152)

Expand All @@ -52,7 +52,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.novoda:gradle-static-analysis-plugin:0.8'
classpath 'com.novoda:gradle-static-analysis-plugin:1.1'
}
}
Expand All @@ -63,7 +63,7 @@ or from the [Gradle Plugins Repository](https://plugins.gradle.org/):

```gradle
plugins {
id 'com.novoda.static-analysis' version '0.8'
id 'com.novoda.static-analysis' version '1.1'
}
```
Expand All @@ -86,7 +86,7 @@ staticAnalysis {
}
```

This will enable all the tools with their default settings. For more advanced configurations, please refer to the
This will enable all the tools with their default settings and create `evaluateViolations` task. Running `./gradlew evaluateViolations` task will run all configured tools and print the reports to console. For more advanced configurations, please refer to the
[advanced usage](docs/advanced-usage.md) and to the [supported tools](docs/supported-tools.md) pages.

## Sample app
Expand All @@ -108,9 +108,8 @@ repositories {
You can find the latest snapshot version following this [link](https://bintray.com/novoda-oss/snapshots/gradle-static-analysis-plugin/_latestVersion).

## Roadmap
The plugin is under active development and to be considered in **beta stage**. It is routinely used by many Novoda projects and
by other external projects with no known critical issues. The API is supposed to be relatively stable, but there still may be
breaking changes as we move towards version 1.0.

Future improvements can be found on the repository's
This project is routinely used by many Novoda projects and by other external projects with no known critical issues.

Future improvements and new tool integrations can be found on the repository's
[issue tracker](https://github.com/novoda/gradle-static-analysis-plugin/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement).
23 changes: 21 additions & 2 deletions docs/incubating/custom-evaluator.md
Expand Up @@ -40,7 +40,7 @@ can be provided as a closure as well:

```gradle
staticAnalysis {
evaluator { Set<Violations> allViolations ->
evaluator { Set allViolations ->
// add your evaluation logic here
}
//...
Expand All @@ -61,10 +61,29 @@ Anything that respect such contract is valid. For example, a custom evaluator mi
* Only break the build if there are errors or warnings in one specific report
* Or anything else that you can think of

For example, this custom evaluator fails the build if PMD errors are greater than five:

```gradle
evaluator { Set allViolations ->
allViolations.each { violation ->
if (violation.name == "PMD" && violation.errors > 5) {
throw new GradleException("PMD Violations exceeded")
}
}
}
```
The properties you can read from a [`Violation`][violationscode] result are:

* `name`: Possible values are: `"PMD"`, `"Checkstyle"`, `"Findbugs"`, `"KTlint"`, `"Detekt"` and `"Lint"`.
* `errors`: Represents the number of errors found during the analysis.
* `warnings`: Represents the number of warnings found during the analysis.
* `reports`: Contains a list of the generated report files.

---
Please note that the presence of an `evaluator` property will make the plugin ignore the `penalty` closure and its thresholds. If you
want to provide behaviour on top of the default [`DefaultViolationsEvaluator`][defaultviolationsevaluatorcode], you can have your own
evaluator run its logic and then delegate the thresholds counting to an instance of `DefaultViolationsEvaluator` you create.

[violationsevaluatorcode]: https://github.com/novoda/gradle-static-analysis-plugin/blob/master/plugin/src/main/groovy/com/novoda/staticanalysis/ViolationsEvaluator.groovy
[defaultviolationsevaluatorcode]: https://github.com/novoda/gradle-static-analysis-plugin/blob/master/plugin/src/main/groovy/com/novoda/staticanalysis/DefaultViolationsEvaluator.groovy
[violationscode]: https://github.com/novoda/gradle-static-analysis-plugin/blob/master/plugin/src/main/groovy/com/novoda/staticanalysis/internal/Violations.groovy
[violationscode]: https://github.com/novoda/gradle-static-analysis-plugin/blob/master/plugin/src/main/groovy/com/novoda/staticanalysis/Violations.groovy
2 changes: 1 addition & 1 deletion gradle/publish.gradle
Expand Up @@ -2,7 +2,7 @@ ext {
websiteUrl = 'https://github.com/novoda/gradle-static-analysis-plugin'
}

version = '1.0'
version = '1.1'
groovydoc.docTitle = 'Static Analysis Plugin'

apply plugin: 'com.novoda.build-properties'
Expand Down

0 comments on commit 78c3a5f

Please sign in to comment.