You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`SKIP_FOLDERS`| - | `tests`,`tests,.github` (Any other comma seprated top level directories in the repo) | If any specific folders should be ignored when scanning, then a comma seprated list of values should be added to this env variable.
70
70
`PHPCS_SNIFFS_EXCLUDE`| - | `WordPress.Files.FileName` (Any other comma seprated list of valid sniffs) | Single sniff or comma seprated list of sniffs to be excluded from the phpcs scan.
71
71
`PHP_LINT`| `true` | `true` or `false`, *case insensitive* (Any unknown value is the same as passing `true`) | If the default automatic linting of all PHP files should be deactivated, then this env variable should be set to `false`.
`PHPCS_FILE_PATH`| - | Custom phpcs execution file path from project. i.e Composer phpcs path. 'vendor/bin/phpcs' | This is useful in case of needed to use any custom coding standards apart from pre-defined in VIP/WP Coding Standards.
74
+
75
+
## Modifying the bot’s behavior
76
+
77
+
You can change the bot’s behavior by placing a configuration file named `.vipgoci_options` at the root of the relevant repository. This file must contain a valid JSON string for this to work; if the file is not parsable, it will be ignored. This file is where you can add code to turn off support messages as well as adjust PHPCS severity levels.
78
+
79
+
i.e: You can update phpcs severity:
80
+
```json
81
+
{
82
+
"phpcs-severity": 5
83
+
}
84
+
```
85
+
86
+
Allowed options:
87
+
- `"skip-execution"`
88
+
- `"skip-draft-prs"`
89
+
- `"results-comments-sort"`
90
+
- `"review-comments-include-severity"`
91
+
- `"phpcs"`
92
+
- `"phpcs-severity"`
93
+
- `"post-generic-pr-support-comments"`
94
+
- `"phpcs-sniffs-include"`
95
+
- `"phpcs-sniffs-exclude"`
96
+
- `"hashes-api"`
97
+
- `"svg-checks"`
98
+
- `"autoapprove"`
99
+
- `"autoapprove-php-nonfunctional-changes`
100
+
101
+
For more details please check the documentation for [all options here](https://github.com/automattic/vip-go-ci#configuration-via-repository-config-file).
102
+
## Skipping PHPCS scanning for specific folders
103
+
104
+
You can add files to the root of the repository indicating folders that should not be scanned. For PHPCS, the file should be named `.vipgoci_phpcs_skip_folders`. For PHP Linting the file should be named `.vipgoci_lint_skip_folders`. Please ensure both files are located in the root of the repository.
105
+
106
+
List each folder to be skipped on individual lines within those files.
107
+
108
+
i.e:
109
+
```
110
+
foo
111
+
tests/bar
112
+
vendor
113
+
node_modules
114
+
```
115
+
116
+
For more details, please check the documentation [here](https://github.com/automattic/vip-go-ci#skipping-certain-folders).
72
117
73
118
## PHPCS Coding Standards
74
119
@@ -97,12 +142,24 @@ By default, `WordPress-Core,WordPress-Docs` value is passed.
97
142
98
143
### Custom Sniffs
99
144
100
-
If your git repo have a file named `phpcs.xml` in the root of the repository, then that will take precedence. In that case, value passed to args such as `args = ["WordPress,WordPress-Core,WordPress-Docs"]` will be ignored.
145
+
Default filename supported:
146
+
- `.phpcs.xml`
147
+
- `phpcs.xml`
148
+
- `.phpcs.xml.dist`
149
+
- `phpcs.xml.dist`
150
+
151
+
If your git repo has a file named `phpcs.xml` in the root of the repository, then that will take precedence. In that case, value passed to args such as `args = ["WordPress,WordPress-Core,WordPress-Docs"]` will be ignored.
101
152
102
153
If your git repo doesn't have `phpcs.xml` and you do not specify `args` in `main.workflow` PHPCS action, then this actions will fallback to default.
103
154
155
+
If your git repo has phpcs ruleset file other than default filename list, use `PHPCS_STANDARD_FILE_NAME` environment var to provide filename.
156
+
104
157
Here is a sample [phpcs.xml](https://github.com/rtCamp/github-actions-wordpress-skeleton/blob/master/phpcs.xml) you can use in case you want to use custom sniffs.
105
158
159
+
### Custom Coding Standards
160
+
161
+
If you have custom coding standards from your git repository, you can use composer and use `phpcs` from execution from your repository phpcs file with the help of `PHPCS_FILE_PATH` environment variable.
0 commit comments