Skip to content
Open
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
80 changes: 43 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,7 @@ This is a list of regex patterns that will filter files to validate. With this o

### PhpMd Extended

Extends the default PhpMd task and splits the files into smaller chunks to prevent the `Argument list too long` error.

***Composer***

```
composer require --dev phpmd/phpmd
```
Extends the default [PhpMd task](vendor/phpro/grumphp/doc/tasks/phpmd.md) and splits the files into smaller chunks to prevent the `Argument list too long` error.

***Config***

Expand All @@ -216,48 +210,60 @@ grumphp:
chunks_size: 1000
```

**whitelist_patterns**

*Default: []*

This is a list of regex patterns that will filter files to validate. With this option you can skip files like tests. This option is used in relation with the parameter `triggered_by`.
For example: whitelist files in `src/FolderA/` and `src/FolderB/` you can use
```yaml
whitelist_patterns:
- /^src\/FolderA\/(.*)/
- /^src\/FolderB\/(.*)/
```

**exclude**
**chunk_size**

*Default: []*
*Default: 1000*

This is a list of patterns that will be ignored by phpmd. With this option you can skip directories like tests. Leave this option blank to run phpmd for every php file.
This parameter defines how many files will be checked in one execution of phpmd. This can help with performance on large codebases.

**report_format**
### PHPStan Extended

*Default: text*
Extends the default [PHPStan task](vendor/phpro/grumphp/doc/tasks/phpstan.md) and splits the files into smaller chunks to prevent the `Argument list too long` error.

This sets the output [renderer](https://phpmd.org/documentation/#renderers) of phpmd.
Available formats: ansi, text.
***Config***

**ruleset**
The task lives under the `phpstan_extended` namespace and has following configurable parameters:

*Default: [cleancode,codesize,naming]*
```yaml
# grumphp.yml
grumphp:
tasks:
phpstan_extended:
autoload_file: ~
chunk_size: 1000
configuration: ~
level: null
force_patterns: []
ignore_patterns: []
triggered_by: ['php']
memory_limit: "-1"
use_grumphp_paths: true
```

With this parameter you will be able to configure the rule/rulesets you want to use. You can use the standard
sets provided by PhpMd or you can configure your own xml configuration as described in the [PhpMd Documentation](https://phpmd.org/documentation/creating-a-ruleset.html)
**chunk_size**

The full list of rules/rulesets can be found at [PhpMd Rules](https://phpmd.org/rules/index.html)
*Default: 1000*

**triggered_by**
This parameter defines how many files will be checked in one execution of phpstan. This can help with performance on large codebases.

*Default: [php]*
### XmlLint Extended

This is a list of extensions to be sniffed.
Extends the default [XmlLint task](vendor/phpro/grumphp/doc/tasks/xmllint.md) with strict schema validation.
Require `ext-dom` and `ext-libxml` extensions.

**chunk_size**
***Config***

*Default: 1000*
It lives under the `xmllint_extended` namespace and has following configurable parameters:

This parameter defines how many files will be checked in one execution of phpmd. This can help with performance on large codebases.
```yaml
# grumphp.yml
grumphp:
tasks:
xmllint_extended:
ignore_patterns: []
load_from_net: false
x_include: false
dtd_validation: false
scheme_validation: false
triggered_by: ['xml']
```
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"squizlabs/php_codesniffer": "^4.0"
},
"require-dev": {
"ext-dom": "*",
"ext-libxml": "*",
"ergebnis/composer-normalize": "^2.45",
"friendsofphp/php-cs-fixer": "^3.89",
"nikic/php-parser": "^5.6",
Expand Down
18 changes: 18 additions & 0 deletions config/grumphp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,21 @@ services:
- "@formatter.raw_process"
tags:
- { name: grumphp.task, task: phpmd_extended }

PixelFederation\CodingStandards\GrumPHP\Task\PhpStanExtendedTask:
class: PixelFederation\CodingStandards\GrumPHP\Task\PhpStanExtendedTask
arguments:
- "@process_builder"
- "@formatter.raw_process"
tags:
- { name: grumphp.task, task: phpstan_extended }

PixelFederation\CodingStandards\GrumPHP\Linter\Xml\XmlLinter:
class: PixelFederation\CodingStandards\GrumPHP\Linter\Xml\XmlLinter

PixelFederation\CodingStandards\GrumPHP\Task\XmlLintExtendedTask:
class: PixelFederation\CodingStandards\GrumPHP\Task\XmlLintExtendedTask
arguments:
- '@PixelFederation\CodingStandards\GrumPHP\Linter\Xml\XmlLinter'
tags:
- {name: grumphp.task, task: xmllint_extended}
5 changes: 3 additions & 2 deletions grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ grumphp:
blacklist:
- 'Dumper::dump'
triggered_by: [ 'php' ]
phpstan:
phpstan_extended:
chunk_size: 500
autoload_file: ~
configuration: 'phpstan.dist.neon'
level: max
Expand All @@ -71,7 +72,7 @@ grumphp:
'tests/',
]
triggered_by: [ 'php' ]
xmllint:
xmllint_extended:
ignore_patterns: [ ]
load_from_net: true
x_include: true
Expand Down
Loading