[ofbiz-framework] branch trunk updated: Implemented: pre commit hook to check staged files with list issues (OFBIZ-11304)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Implemented: pre commit hook to check staged files with list issues (OFBIZ-11304)

adityasharma
This is an automated email from the ASF dual-hosted git repository.

adityasharma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 4be4773  Implemented: pre commit hook to check staged files with list issues (OFBIZ-11304)
4be4773 is described below

commit 4be47732c7b29b9cbae8675ff7d5686f4e84891f
Author: Aditya Sharma <[hidden email]>
AuthorDate: Fri Jun 12 21:31:52 2020 +0530

    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.
---
 build.gradle | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index 0787473..edb935c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -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 ->