Package: igcommit
It is exhausting to edit files again and again to have a consistent style.
This project provides a Git pre-receive hook to validate pushed commits on
the Git server side.  The hook avoids all issues by rejecting any commit
not matching the rules to get in to the repository in the first place.The pre-receive hook runs some checks on commits on its own, and searches
for programming language specific syntax checkers on the PATH of the server
to check changed files with them.  The process is pretty fast, because only
the added and modified files on the pushed commits are passed to the syntax
checkers, also in parallel.  It wouldn’t slow you down unless your commits
are touching hundreds of files.InstallationIt is possible to install the tool withpip:pip install igcommitLink thescripttohooks/pre-receiveon you Git
repositories on your Git server:ln -s igcommit-receive /home/git/repositories/myproject.git/hooks/pre-receiveFeaturesValidate received commits one by one not just the last oneOnly validate added or modified files on the commitsReport all problems before failingCheck for duplicate commit summariesCheck for misleading merge commitsValidate committer and author timestampsValidate committer and author names and email addressesCheck commit message best practices (80 lines, first line summary…)Check commit summary formattingValidate commit tags against a list[BUGFIX],[FEATURE],[WIP]…Check for changed file pathsAccept commits tagged as[HOTFIX],[MESS],[TEMP], or[WIP]with issuesCheck executable bits and shebangsCheck symlinksCheck CSS files withcsslintCheck Go files withgolintCheck HTML files withhtmlhintCheck Puppet files withpuppet parser validateandpuppet-lintCheck Python files withflake8orpycodestyleandpyflakesCheck Ruby files withrubocopCheck shell scripts withshellcheckCheck JavaScript files witheslint,jshint,jscs, orstandardCheck CoffeeScript files withcoffeelintCheck PHP files withphpcsRun the external check commands in parallelValidate JSON, XML, YAML file formatsHere is an example problem output:=== CheckDuplicateCommitSummaries on CommitList ===
ERROR: summary "Add nagios check for early expiration of licenses" duplicated 2 times

=== CheckCommitSummary on 31d0f6b ===
WARNING: summary longer than 72 characters

=== CheckCommitSummary on 6bded65 ===
WARNING: past tense used on summary

=== CheckCommand "flake8" on src/check_multiple.py at 6bded65 ===
INFO: line 10 col 5: E225 missing whitespace around operator
INFO: line 17 col 80: E501 line too long (122 > 79 characters)
INFO: line 17 col 85: E203 whitespace before ','

=== CheckCommitMessage on 6fdbc00 ===
WARNING: line 7 is longer than 80
WARNING: line 9 is longer than 80ConfigurationThe script itself is currently configuration free.  Though, some of the syntax
checkers called by the script uses or requires configurations.  Those
configuration files has to be on the top level of the Git repository.Syntax CheckerConfiguration Filecoffeelintcoffeelint.json, or package.jsonoptionalcsslint.csslintrcoptionaleslinteslint.(js|yaml|yml|json), or package.jsonrequiredflake8.flake8, setup.cfg, or tox.inioptionalhtmlhint.htmlhintrcoptionaljscs.jscsrc, .jscs.json, or package.jsonrequiredjshint.jshintrc, or package.jsonoptionalphpcsphpcs.xml, or phpcs.xml.distoptionalpuppet-lint.puppet-lint.rcoptionalpycodestylesetup.cfg, or tox.inioptionalrubocop.rubocop.ymloptionalPros and Cons of Pre-receive HookContinuous Integration ServerA continuous integration server can run such checks with the many other
things it is doing.  Moving this job from it has many benefits:Synchronous feedbackMore efficientDisallow any commit violating the rulesPre-commit HookEven though, pre-receive hook gives later feedback than pre-commit hook,
it has many advantages over it:No client side configurationPlugins has to be installed only once to the Git serverEverybody gets the same checksEnforcement, nobody can skip the checksCommit checking (pre-commit hook only gets what is changed in the commit)IDE IntegrationThe same advantages compared to pre-commit hooks applies to IDE
integration.  Though, IDE integration gives much sooner and nicer feedback,
so it is still a good idea, even with the pre-receive hook.DependenciesThe script has no dependencies on Python 3.4 or above.  The script executes
the validation commands using the shell.  The necessary ones for checked
repositories need to be installed separately.  See the complete list of
commands on theconfig.py.  The commands which are not
available on thePATHis not going to be used.TestingI found it useful to check what the script would have complained if it had
been active on different Git repositories.  You can run a command like this
to test this inside a Git repository against last 50 commits:git log --reverse --oneline HEAD~50..HEAD |
    sed 's:\([^ ]*\) .*:\1 \1 refs/heads/master:' |
    python ../igcommit/igcommit-receiveChangesVersion 2.0Fix line numbers on syntax errors for executables being 1 offRecognize and validate symlinksValidate committer and author timestampsValidate contributor names and email addressesReduce commit message line length limitsComplain about file extensions on executablesVersion 2.1Add [TEMP] to recognized commit tagsFix getting the changes of the initial commit (Zheng Wei)Fix various file descriptor leaksCheck commit summaries more strictlyCheck shebangs of non-executable files tooDon’t check on empty file contentsImprove unicode support on Python 2Fix checking symlink targetsVersion 2.2Fixeslintconfiguration (Jerevia)Accepts commits with[TEMP]with issuesStop skipping empty filesMake sure not to get unknown file contentsMove file extensions to configIncrease timestamp comparison tolerance for 1 more minuteHandle spaces on shebangsVersion 2.3Handle check command failing immediatelySupport pushed tagsFix failing on file check with bogus return codeInclude list of commit tags on warningFix recognising commit tags[REVIEW]and[SECURITY]Version 2.4Fix recognising removed configuration filesSupportcoffeelintVersion 2.5Fix unicode issue on Python 2 for XML, YAML, and JSON (jcoetsie)Version 3.0Drop Python 2 supportFix handling filenames with spaces (Friz-zy)Version 3.1Stop complaining about the same commit for Git tagsFix checking contributor names and email addressesStop complaining about file extensions we don’t know aboutFilter out checking format of files undertemplates/directoriesImprove code quality and styleVersion 3.2Reduce severity of length for merge commit summary to warningLicenseThe script is released under the MIT License.  The MIT License is registered
with and approved by the Open Source Initiative[1].[1]https://opensource.org/licenses/MIT