diff --git a/.gitignore b/.gitignore index 81c33b22aac..a73007c3ad5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.mvn/.gradle-enterprise/ .scannerwork/ .vscode *.iml @@ -29,6 +30,8 @@ packages/ .vagrant/ .vscode/ **/.vs +bin +.factorypath .settings diff --git a/README.md b/README.md index 6a5a81e8966..da24519d45a 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,12 @@ If you don't have maven installed, you may directly use the included [maven wrap ./mvnw clean install ``` +The default build contains minimal static analysis (via CheckStyle). To run your build with PMD and Spotbugs, use the `static-analysis` profile: + +```sh +mvn -Pstatic-analysis clean install +``` + ### [1.5 - Homebrew](#table-of-contents) To install, run `brew install openapi-generator` diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 6aa9eb42def..940242562ec 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -26,6 +26,13 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.parent.basedir}${file.separator}google_checkstyle.xml + + org.apache.maven.plugins maven-jar-plugin @@ -73,6 +80,31 @@ + + + static-analysis + + + + com.github.spotbugs + spotbugs-maven-plugin + + ${project.parent.basedir}${file.separator}spotbugs-exclude.xml + + + + org.apache.maven.plugins + maven-pmd-plugin + + + se.bjurr.violations + violations-maven-plugin + + + + + + diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml index 58e2f5714d2..c0b948f9849 100644 --- a/modules/openapi-generator-core/pom.xml +++ b/modules/openapi-generator-core/pom.xml @@ -16,6 +16,18 @@ openapi-generator-core https://github.com/openapitools/openapi-generator + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.parent.basedir}${file.separator}google_checkstyle.xml + + + + + com.google.guava @@ -34,6 +46,31 @@ + + + static-analysis + + + + com.github.spotbugs + spotbugs-maven-plugin + + ${project.parent.basedir}${file.separator}spotbugs-exclude.xml + + + + org.apache.maven.plugins + maven-pmd-plugin + + + se.bjurr.violations + violations-maven-plugin + + + + + + 1.7.12 26.0-jre diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index 3508398624d..3faf989a6bb 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -65,6 +65,13 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.parent.basedir}${file.separator}google_checkstyle.xml + + org.fortasoft @@ -104,4 +111,28 @@ + + + static-analysis + + + + com.github.spotbugs + spotbugs-maven-plugin + + ${project.parent.basedir}${file.separator}spotbugs-exclude.xml + + + + org.apache.maven.plugins + maven-pmd-plugin + + + se.bjurr.violations + violations-maven-plugin + + + + + diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml index d74b8ff5624..84844cc99c1 100644 --- a/modules/openapi-generator-maven-plugin/pom.xml +++ b/modules/openapi-generator-maven-plugin/pom.xml @@ -89,6 +89,13 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.parent.basedir}${file.separator}google_checkstyle.xml + + net.revelc.code formatter-maven-plugin @@ -99,4 +106,29 @@ + + + + static-analysis + + + + com.github.spotbugs + spotbugs-maven-plugin + + ${project.parent.basedir}${file.separator}spotbugs-exclude.xml + + + + org.apache.maven.plugins + maven-pmd-plugin + + + se.bjurr.violations + violations-maven-plugin + + + + + diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml index 1d50a9c70f4..bba07959468 100644 --- a/modules/openapi-generator-online/pom.xml +++ b/modules/openapi-generator-online/pom.xml @@ -42,6 +42,13 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.parent.basedir}${file.separator}google_checkstyle.xml + + org.springframework.boot spring-boot-maven-plugin @@ -56,6 +63,35 @@ + + + + static-analysis + + + + com.github.spotbugs + spotbugs-maven-plugin + + ${project.parent.basedir}${file.separator}spotbugs-exclude.xml + + + + org.apache.maven.plugins + maven-pmd-plugin + + + se.bjurr.violations + violations-maven-plugin + + + 3 + + + + + + org.springframework.boot diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 69f0314bb62..dea98573b94 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -43,6 +43,13 @@ target ${project.artifactId}-${project.version} + + org.apache.maven.plugins + maven-checkstyle-plugin + + ${project.parent.basedir}${file.separator}google_checkstyle.xml + + org.codehaus.mojo exec-maven-plugin @@ -155,6 +162,33 @@ + + static-analysis + + + + com.github.spotbugs + spotbugs-maven-plugin + + ${project.parent.basedir}${file.separator}spotbugs-exclude.xml + + + + org.apache.maven.plugins + maven-pmd-plugin + + + se.bjurr.violations + violations-maven-plugin + + + 65 + + + + + target/site diff --git a/pom.xml b/pom.xml index 2bfd23742cf..721f86d042c 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,25 @@ target ${project.artifactId}-${project.version} + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.plugin.version} + + false + false + **/samples/*.java + + + + checkstyle-check + + check + + verify + + + net.revelc.code formatter-maven-plugin @@ -360,11 +379,64 @@ + + se.bjurr.violations + violations-maven-plugin + ${violations-maven.plugin.version} + + 0 + VERBOSE + ERROR + + + FINDBUGS + Spotbugs + ${project.basedir} + .*/spotbugsXml\.xml$ + + + PMD + PMD + ${project.basedir} + .*/pmd\.xml$ + + + CHECKSTYLE + Checkstyle + ${project.basedir} + .*/checkstyle-result\.xml$ + + + + + + verify + + violations + + + + net.revelc.code formatter-maven-plugin 0.5.2 + + com.github.spotbugs + spotbugs-maven-plugin + ${spotbugs.plugin.version} + + + org.apache.maven.plugins + maven-pmd-plugin + ${pmd.plugin.version} + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.plugin.version} + @@ -470,6 +542,73 @@ + + + + static-analysis + + true + true + + + + + com.github.spotbugs + spotbugs-maven-plugin + ${spotbugs.plugin.version} + + false + + min + ${project.basedir}${file.separator}spotbugs-exclude.xml + + + + spotbugs-check + + check + + verify + + + + + org.apache.maven.plugins + maven-pmd-plugin + ${pmd.plugin.version} + + ${project.build.sourceEncoding} + false + false + + category/java/errorprone.xml + + + **/samples/**/* + + + + + pmd-check + + check + + verify + + + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + ${spotbugs.plugin.version} + + + + android-client @@ -1464,5 +1603,9 @@ 0.9.10 3.2.0 0.8.5 + 3.1.12.2 + 3.12.0 + 1.34 + 3.1.0 diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml new file mode 100644 index 00000000000..82568cd7d08 --- /dev/null +++ b/spotbugs-exclude.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file