# grumphp.yml
# Please add a copy of your grumphp.yml file.
grumphp:
tasks:
phpcs:
standard:
- 'PSR12'
warning_severity: 0
error_severity: 5
phpmd:
whitelist_patterns: []
exclude: []
report_format: text
ruleset: ['unusedcode']
triggered_by: ['php']
git_blacklist:
keywords:
- "die("
- "var_dump("
- "print_r("
triggered_by: [php]
regexp_type: G
Steps to reproduce:
I updated php file and added it for commit.
after that i did git diff --staged
which shows correct diff
--- a/product_info.php
+++ b/product_info.php
@@ -11,6 +11,7 @@
/**
* include common
*/
+echo 213;
require_once("lib/common.php");
But when i commited using below command,
git commit -m "commit test"
it shows error on the lines which is not touched/modified.
phpcs
=====
FILE: product_info.php
----------------------------------------------------------------------
FOUND 100 ERRORS AFFECTING 81 LINES
----------------------------------------------------------------------
111 | ERROR | [x] Expected 1 space(s) after IF keyword; 0 found
| | (Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword)
185 | ERROR | [x] Spaces must be used to indent lines; tabs are not
| | allowed
| | (Generic.WhiteSpace.DisallowTabIndent.TabsUsed)
186 | ERROR | [x] Spaces must be used to indent lines; tabs are not
| | allowed
| | (Generic.WhiteSpace.DisallowTabIndent.TabsUsed)
202 | ERROR | [x] Spaces must be used to indent lines; tabs are not
| | allowed
| | (Generic.WhiteSpace.DisallowTabIndent.TabsUsed)
202 | ERROR | [x] Whitespace found at end of line
| | (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
209 | ERROR | [x] Inline control structures are not allowed
| | (Generic.ControlStructures.InlineControlStructure.NotAllowed)
265 | ERROR | [x] Inline control structures are not allowed
| | (Generic.ControlStructures.InlineControlStructure.NotAllowed)
269 | ERROR | [x] Inline control structures are not allowed
| | (Generic.ControlStructures.InlineControlStructure.NotAllowed)
281 | ERROR | [x] Inline control structures are not allowed
| | (Generic.ControlStructures.InlineControlStructure.NotAllowed)
283 | ERROR | [x] Inline control structures are not allowed
| | (Generic.ControlStructures.InlineControlStructure.NotAllowed)
285 | ERROR | [x] Inline control structures are not allowed
| | (Generic.ControlStructures.InlineControlStructure.NotAllowed)
288 | ERROR | [x] Blank line found at start of control
| | structure
| | (Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen)
Not sure why this is happening as above lines are not modified during this commit.
Am i missing any configurations here? What i want to achieve is to validate the code which is modified and staged only.
It should not validate other lines written in the file.
1.15.0
My configuration
Steps to reproduce:
I updated php file and added it for commit. after that i did git diff --staged which shows correct diff
But when i commited using below command, git commit -m "commit test" it shows error on the lines which is not touched/modified.
Not sure why this is happening as above lines are not modified during this commit. Am i missing any configurations here? What i want to achieve is to validate the code which is modified and staged only. It should not validate other lines written in the file.