-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from YouweGit/feature/split-grumphp-config-tem…
…plates Split out grumphp configuration into magento2 and pimcore options
- Loading branch information
Showing
10 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
imports: | ||
- resource: '../default/grumphp.yml' | ||
|
||
# Extend git blacklist and triggers with Magento constructs | ||
parameters: | ||
git_blacklist.keywords: | ||
- "die(" | ||
- "dd(" | ||
- "var_dump(" | ||
- "console.log(" | ||
- "alert(" | ||
- "print_r(" | ||
- "phpinfo(" | ||
- "exit;" | ||
- "<<<<<" | ||
- ">>>>>" | ||
- "=====" | ||
- "<?php echo" | ||
- "Magento\\\\Framework\\\\App\\\\ObjectManager" | ||
git_blacklist.triggered_by: [ 'php', 'js', 'phtml' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
imports: | ||
- resource: '../default/grumphp.yml' | ||
|
||
# Extend git triggers with common pimcore constructs | ||
parameters: | ||
git_blacklist.triggered_by: [ 'php', 'js', 'twig' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Git commit keyword validation | ||
|
||
## Purpose | ||
Every commit, blacklisted phrases are scanned within scanned files containing a specified file extension.\ | ||
The purpose of these checks is to prevent committing production-breaking or sensative system information. | ||
|
||
## Keywords used | ||
**_Note:_** some example configuration is below. Specific packages might override the default configuration. | ||
|
||
To prevent accidental commits of specific syntax that may cause issues, the testing suite sniffs\ | ||
several keywords in your commits. | ||
|
||
### Preventing production logs, debug statements and leaking sensitive system information | ||
```yaml | ||
- "die(" | ||
- "dd(" | ||
- "var_dump(" | ||
- "console.log(" | ||
- "alert(" | ||
- "print_r(" | ||
- "phpinfo(" | ||
``` | ||
|
||
### Preventing accidental committing of merge conflicts | ||
```yaml | ||
- "<<<<<" | ||
- ">>>>>" | ||
- "=====" | ||
``` | ||
|
||
### Preventing statements that have better alternatives | ||
```yaml | ||
- "<?php echo" | ||
``` | ||
|
||
* The magento2 coding standards extend this with invocation of the ObjectManager. | ||
|
||
## Files scanned | ||
The following files are scanned for blacklisted keywords in a default configuration. | ||
|
||
**_Note:_** different project types might override the files scanned. | ||
```yaml | ||
- .php | ||
- .js | ||
``` | ||
* Magento2 project types extend this with .phtml files. | ||
* Pimcore project types extend this with .twig files. | ||
|
||
## Override the configuration | ||
To override the default git blacklist with your own, override the configuration in the `grumphp.yml` file\ | ||
in your local project. An example configuration can be found below. | ||
|
||
Full details of available configuration options can be found [here](https://github.com/phpro/grumphp/blob/master/doc/tasks/git_blacklist.md). | ||
|
||
Note: configuration keys are **overwritten, not merged**. | ||
|
||
```yaml | ||
imports: | ||
- resource: 'vendor/youwe/testing-suite/config/default/grumphp.yml' | ||
|
||
parameters: | ||
git_blacklist.keywords: | ||
- "die(" | ||
- "dd(" | ||
- "var_dump(" | ||
- "console.log(" | ||
- "alert(" | ||
- "print_r(" | ||
- "phpinfo(" | ||
- "exit;" | ||
- "<<<<<" | ||
- ">>>>>" | ||
- "=====" | ||
- "<?php echo" | ||
- "My additional keyword" | ||
git_blacklist.triggered_by: [ 'php', 'js', 'additional_file_extension_here' ] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
imports: | ||
- resource: 'vendor/youwe/testing-suite/config/pimcore/grumphp.yml' |