Skip to content

Commit 031f903

Browse files
authored
Merge pull request #38 from rtCamp/add/option-to-exclude-sniff
Add option to exclude phpcs sniffs
2 parents 50fbd30 + 791763a commit 031f903

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
env:
3434
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
3535
SKIP_FOLDERS: "tests,.github"
36+
PHPCS_SNIFFS_EXCLUDE: "WordPress.Files.FileName"
3637
with:
3738
args: "WordPress,WordPress-Core,WordPress-Docs"
3839
```
@@ -66,6 +67,7 @@ Private | Complete `repo` and `write:discussion` permissions | [Screenshot Pr
6667
Variable | Default | Possible Values | Purpose
6768
---------------|---------|-----------------------------|----------------------------------------------------
6869
`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+
`PHPCS_SNIFFS_EXCLUDE` | - | `WordPress.Files.FileName`, `WordPress.Files.FileName,Generic.Arrays.DisallowShortArraySyntax` | Single sniff or comma seprated list of sniffs to be excluded from the phpcs scan.
6971
`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`.
7072

7173
## PHPCS Coding Standards

main.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ if [[ $phpcsfilefound -ne 0 ]]; then
6868
fi
6969
fi
7070

71+
[[ -z "$PHPCS_SNIFFS_EXCLUDE" ]] && phpcs_sniffs_exclude='' || phpcs_sniffs_exclude="--phpcs-sniffs-exclude='$PHPCS_SNIFFS_EXCLUDE'"
72+
7173
[[ -z "$SKIP_FOLDERS" ]] && skip_folders_option='' || skip_folders_option="--skip-folders='$SKIP_FOLDERS'"
7274

7375
/usr/games/cowsay "Running with the flag $phpcs_standard"
@@ -78,6 +80,6 @@ if [[ "$(echo "$PHP_LINT" | tr '[:upper:]' '[:lower:]')" = 'false' ]]; then
7880
fi
7981

8082
echo "Running the following command"
81-
echo "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=\$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $skip_folders_option $php_lint_option"
83+
echo "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=\$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $phpcs_sniffs_exclude $skip_folders_option $php_lint_option"
8284

83-
gosu rtbot bash -c "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $skip_folders_option $php_lint_option"
85+
gosu rtbot bash -c "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $phpcs_sniffs_exclude $skip_folders_option $php_lint_option"

0 commit comments

Comments
 (0)