Implemented: pre commit hook to check staged files with list issues (OFBIZ-11304)

* Implemented: pre commit hook to check staged files with list issues
(OFBIZ-11304)
Used git-hooks-gradle-plugin with MIT license that helps configure shared Git hooks with Gradle buildscript
https://github.com/jakemarsden/git-hooks-gradle-plugin

* Improved: used exisiting checkstyleMain to check for the voilations
(OFBIZ-11304)
checkstyleMain will only fail in case when maxErrors increases
Thank you Jacques for the suggestion

* Improved: getChangedFiles() to check all the files
(OFBIZ-11304)
Initially the method only checks for the java files, so removed the code to filter java files

* Removed: custom checkstyle gradle task
(OFBIZ-11304)
Existing checkstyleMain task fulfills the requirement


Thank you Jacques, Mathieu, Samuel, and Pierre for your valuable inputs.
This commit is contained in:
Aditya Sharma
2020-06-12 21:31:52 +05:30
committed by GitHub
parent 575defd088
commit 4be47732c7
+6 -2
View File
@@ -29,12 +29,13 @@ plugins {
id 'eclipse'
id 'checkstyle'
id 'maven-publish'
id 'at.bxm.svntools' version '2.2.1' // Don't update as long as we don't use Java 11, it's needed by version 3
id 'at.bxm.svntools' version '2.2.1' // Don't update as long as we don't use Java 11, it's needed by version 3
id 'org.asciidoctor.convert' version '2.4.0' // About org.asciidoctor.jvm.convert as it says itself: "If you need a production-ready version of the AsciidoctorJ plugin for Gradle use a 1.5.x release of 'org.asciidoctor.convert' instead"
id 'org.owasp.dependencycheck' version '5.3.2.1' apply false
id 'se.patrikerdes.use-latest-versions' version '0.2.13' apply false
id 'com.github.ben-manes.versions' version '0.28.0' apply false
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
id "com.github.jakemarsden.git-hooks" version "0.0.2"
}
/* OWASP plugin
@@ -286,11 +287,14 @@ checkstyle {
// the sum of errors found last time it was changed after using the
// ‘checkstyle’ tool present in the framework and in the official
// plugins.
tasks.checkstyleMain.maxErrors = 26845
tasks.checkstyleMain.maxErrors = 26844
// Currently there are a lot of errors so we need to temporarily
// hide them to avoid polluting the terminal output.
showViolations = false
}
gitHooks {
hooks = ['pre-commit': 'checkstyleMain']
}
// Eclipse plugin settings
eclipse.classpath.file.whenMerged { classpath ->