2017 © Pedro Peláez
 

library pgca

Analyzes Git commit messages for poor committing practices and reports a list of violations

image

anroots/pgca

Analyzes Git commit messages for poor committing practices and reports a list of violations

  • Tuesday, April 28, 2015
  • by anroots
  • Repository
  • 1 Watchers
  • 1 Stars
  • 20 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

PHP Git Commit Analyser

Latest Version Software License Build Status Coverage Status Quality Score Quality Score Total Downloads, (*1)

A CLI tool which analyses Git commits for violations., (*2)

This project aims to improve the quality of your commit practices by applying a set of rules against your commit (message) and then yelling at you when you get too lazy., (*3)

The project was born from frustration of seeing commit messages like "fix some stuff" and people's inability to write good commit messages., (*4)

Development status: Alpha, ongoing. Unstable public API. Is usable., (*5)

Install

  • Include via Composer:
{ 
  "require": {
    "anroots/pgca": "~0.2"
  }
}
  • Copy config/pgca.yml into your project root
  • Customize the contents of pgca.yml

Usage

To analyze the commit history of the current project, run the analyzer from the command line:, (*6)

athena PhpstormProjects/todo-app ‹develop*› » vendor/bin/pgca analyze       
PGCA report, generated on 2015-04-25 11:01:04
+---------+------------+-------------------------+--------------------------------------------------+
| Commit  | Author     | Commit Message          | Explanation                                      |
+---------+------------+-------------------------+--------------------------------------------------+
| 2dda109 | Ando Roots | Add a note to the RE... | The Summary line should be 50 or less characters |
| 342a207 | Ando Roots | Readme additions        | Commit message is really short                   |
| 8ba29a8 | Ando Roots | Add five new Rules      | Commit message is really short                   |
| a7c97f9 | Ando Roots | Refactor AbstractRul... | The Summary line should be 50 or less characters |
| 9a43610 | Ando Roots | Reformat code           | Commit message is really short                   |
| 2b29b55 | Ando Roots | Allow to pass option... | The Summary line should be 50 or less characters |
| 2efbbe5 | Ando Roots | Add --limit and --fr... | The Summary line should be 50 or less characters |
+---------+------------+-------------------------+--------------------------------------------------+
Found a total of 80 commits, skipped 0 and analyzed 80 of them.
The total score was 7

You can customize the analysis in the pgca.yml file and with CLI options., (*7)

Print the "simple" report in table format to the console and analyse the last 40 Git commits of the current branch:, (*8)

$ vendor/bin/pgca analyze --report-printer=console --report-serializer=console --report-composer=simple --provider-revision=HEAD~40..HEAD                                                                                       1 ↵
PGCA report, generated on 2015-04-12 15:08:06
+---------+------------+-------------------------+--------------------------------------------------+
| Commit  | Author     | Commit Message          | Explanation                                      |
+---------+------------+-------------------------+--------------------------------------------------+
| 342a207 | Ando Roots | Readme additions        | Commit message is really short                   |
| 8ba29a8 | Ando Roots | Add five new Rules      | Commit message is really short                   |
| a7c97f9 | Ando Roots | Refactor AbstractRul... | The Summary line should be 50 or less characters |
+---------+------------+-------------------------+--------------------------------------------------+
Found a total of 40 commits, skipped 0 and analyzed 40 of them.
The total score was 3

Documentation

See the wiki for more documentation., (*9)

Requirements

Rules

See the wiki for documentation about standard rules. For a full list of available rules, run vendor/bin/pgca/rules:list:, (*10)

$ vendor/bin/pgca rules:list
+-------------------------------------+----------+
| Name                                | Category |
+-------------------------------------+----------+
| message.hasSummaryAndDescription    | Message  |
| message.isLongEnough                | Message  |
| message.startsWithCapitalLetter     | Message  |
| message.summaryFiftyOrLessChars     | Message  |
| message.oneBlankLineAfterSummary    | Message  |
| message.noTrailingWhitespace        | Message  |
| message.noTrailingNewline           | Message  |
| message.noDoubleWhitespace          | Message  |
| message.allLinesLessThanThreshold   | Message  |
| message.notTypicalNonsense          | Message  |
| message.noProfanity                 | Message  |
| message.noProfanity                 | Message  |
| message.summaryDoesNotEndWithPeriod | Message  |
| content.hasNoIgnoredFiles           | Content  |
+-------------------------------------+----------+

Testing

bash $ phpunit, (*11)

Contributing

Please see CONTRIBUTING for details., (*12)

Backlog

These are the broader topics that need improvement and are planned in the undefined near future:, (*13)

Rule implementations, (*14)

  • [message] summary is in present / imperative form
  • [message] has ticket reference in commit message
  • [message] is in English
  • [content] commit does not contain excessive changed file count (commits that change 100 files)

Refactoring, (*15)

  • Add more in-code documentation
  • Increase unit test coverage
  • Refactor code, from alpha version to 1.0 quality
  • Improve HTML report
  • Add longer 'explanation' block to all rules. Might be 2-3 paragraphs with examples and a long explanation why this particular rule exists

Credits

License

The MIT License (MIT). Please see License File for more information., (*16)

The Versions