Skip to content

Wiki/Reporting: update example output for gitblame reports #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ words:
- pdeveloper
- jscript
- toogood
- mrsperfect

# Used in Wiki Reporting page, "emacs" file.
- defun
72 changes: 40 additions & 32 deletions wiki/Reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,19 +377,21 @@ PHP_CodeSniffer can make use of the `git blame` command to try and determine who
$ phpcs --report=gitblame /path/to/code

PHP CODE SNIFFER GIT BLAME SUMMARY
--------------------------------------------------------------------------------
AUTHOR COUNT (%)
--------------------------------------------------------------------------------
jsmith 51 (40.8)
jblogs 44 (30)
pdeveloper 43 (10.33)
jscript 27 (19.84)
--------------------------------------------------------------------------------
A TOTAL OF 165 SNIFF VIOLATION(S) WERE COMMITTED BY 4 AUTHOR(S)
--------------------------------------------------------------------------------
----------------------------------------------------------------------
AUTHOR (Author %) (Overall %) COUNT
----------------------------------------------------------------------
jsmith (2.25) (61.11) 33
jblogs (2.48) (29.63) 16
pdeveloper (0.78) (5.56) 3
jscript (1.39) (1.85) 1
toogood (3.33) (1.85) 1
----------------------------------------------------------------------
A TOTAL OF 54 SNIFF VIOLATIONS WERE COMMITTED BY 5 AUTHORS
----------------------------------------------------------------------
```

Each author is listed with the number of violations they committed and the percentage of error lines to clean lines. The example report above shows that the developer `pdeveloper` has 43 violations but they only make up 10% of all code they have committed, while `jblogs` has 44 violations but they make up 30% of all their committed code. So these developers have about the same number of total violations, but `pdeveloper` seems to be doing a better job of conforming to the coding standard.
Each author is listed with the number of violations they committed and the percentage of error lines to clean lines. The example report above shows that the developer `jscript` has 1 violation but they only make up 1.39% of all code they have committed, while `toogood` has 1 violation but they make up 3.33% of all their committed code. So these developers have about the same number of total violations, but `jscript` seems to be doing a better job of conforming to the coding standard.


To show a breakdown of the types of violations each author is committing, use the `-s` command line argument.

Expand All @@ -398,18 +400,23 @@ $ phpcs -s --report=gitblame /path/to/code

PHP CODE SNIFFER GIT BLAME SUMMARY
--------------------------------------------------------------------------------
AUTHOR SOURCE COUNT (%)
AUTHOR SOURCE (Author %) (Overall %) COUNT
--------------------------------------------------------------------------------
jsmith 51 (40.8)
Squiz.Files.LineLength 47
PEAR.Functions.FunctionCallSignature 4
jblogs 44 (30)
Squiz.Files.LineLength 40
Generic.CodeAnalysis.UnusedFunctionParameter 2
Squiz.CodeAnalysis.EmptyStatement 1
Squiz.Formatting.MultipleStatementAlignment 1
jsmith (2.25) (61.11) 33
Generic.Files.LineLength.TooLong 22
PEAR.Functions.FunctionCallSignature 1
jblogs (2.48) (29.63) 16
Squiz.Formatting.MultipleStatementAlignment 10
PSR12.Classes.ClosingBrace.StatementAfter 4
Generic.Files.LineLength.TooLong 2
pdeveloper (0.78) (5.56) 3
Generic.CodeAnalysis.UnusedFunctionParameter 3
jscript (1.39) (1.85) 1
Squiz.CodeAnalysis.EmptyStatement 1
toogood (3.33) (1.85) 1
PSR12.Classes.ClosingBrace.StatementAfter 1
--------------------------------------------------------------------------------
A TOTAL OF 95 SNIFF VIOLATION(S) WERE COMMITTED BY 2 AUTHOR(S)
A TOTAL OF 54 SNIFF VIOLATIONS WERE COMMITTED BY 5 AUTHORS
--------------------------------------------------------------------------------
```

Expand All @@ -419,17 +426,18 @@ To include authors with no violations, use the `-v` command line argument.
$ phpcs -v --report=gitblame /path/to/code

PHP CODE SNIFFER GIT BLAME SUMMARY
--------------------------------------------------------------------------------
AUTHOR COUNT (%)
--------------------------------------------------------------------------------
jsmith 51 (40.8)
jblogs 44 (30)
pdeveloper 43 (10.33)
jscript 27 (19.84)
toogood 0 (0)
--------------------------------------------------------------------------------
A TOTAL OF 165 SNIFF VIOLATION(S) WERE COMMITTED BY 5 AUTHOR(S)
--------------------------------------------------------------------------------
----------------------------------------------------------------------
AUTHOR (Author %) (Overall %) COUNT
----------------------------------------------------------------------
jsmith (2.25) (61.11) 33
jblogs (2.48) (29.63) 16
pdeveloper (0.78) (5.56) 3
jscript (1.39) (1.85) 1
toogood (3.33) (1.85) 1
mrsperfect (0) (0) 0
----------------------------------------------------------------------
A TOTAL OF 54 SNIFF VIOLATIONS WERE COMMITTED BY 6 AUTHORS
----------------------------------------------------------------------
```

> [!IMPORTANT]
Expand Down
Loading