From 2da604a4b7020a4520a3006f4ad504424e2d33da Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 27 Jan 2025 12:37:16 +0100 Subject: [PATCH] Add `--ignore-codes` support --- README.md | 7 +++++++ action.yml | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f600965..9c414af 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,13 @@ See [action.yml](action.yml) # Default: '' exclude-checks: '' + # List of error codes to ignore. + # Each error code should be separated with new lines. + # Examples: textdomain_mismatch, WordPress.Security.EscapeOutput.OutputNotEscaped. + # + # Default: '' + ignore-codes: '' + # List of categories to limit checks to. # Each category should be separated with new lines. # Examples: general, security diff --git a/action.yml b/action.yml index 4a83dfe..b9c83e2 100644 --- a/action.yml +++ b/action.yml @@ -33,6 +33,10 @@ inputs: description: 'Exclude certain directories from checks' required: false default: '' + ignore-codes: + description: 'Error codes to ignore' + required: false + default: '' ignore-warnings: description: 'Ignore warnings' required: false @@ -115,7 +119,8 @@ runs: CATEGORIES="${CATEGORIES//$'\n'/,}" EXCLUDE_FILES="${EXCLUDE_FILES//$'\n'/,}" EXCLUDE_DIRS="${EXCLUDE_DIRS//$'\n'/,}" - ADDITIONAL_ARGS="$CHECKS $EXCLUDE_CHECKS $CATEGORIES $IGNORE_WARNINGS $IGNORE_ERRORS $INCLUDE_EXPERIMENTAL $EXCLUDE_FILES $EXCLUDE_DIRS $SEVERITY $ERROR_SEVERITY $WARNING_SEVERITY $INCLUDE_LOW_SEVERITY_ERRORS $INCLUDE_LOW_SEVERITY_WARNINGS $SLUG" + IGNORE_CODES="${IGNORE_CODES//$'\n'/,}" + ADDITIONAL_ARGS="$CHECKS $EXCLUDE_CHECKS $CATEGORIES $IGNORE_CODES $IGNORE_WARNINGS $IGNORE_ERRORS $INCLUDE_EXPERIMENTAL $EXCLUDE_FILES $EXCLUDE_DIRS $SEVERITY $ERROR_SEVERITY $WARNING_SEVERITY $INCLUDE_LOW_SEVERITY_ERRORS $INCLUDE_LOW_SEVERITY_WARNINGS $SLUG" echo "::group::Debugging information" wp-env run cli wp cli info @@ -151,6 +156,7 @@ runs: CATEGORIES: ${{ inputs.categories && format('--categories={0}', inputs.categories) || '' }} EXCLUDE_FILES: ${{ inputs.exclude-files && format('--exclude-files={0}', inputs.exclude-files) || '' }} EXCLUDE_DIRS: ${{ inputs.exclude-directories && format('--exclude-directories={0}', inputs.exclude-directories) || '' }} + IGNORE_CODES: ${{ inputs.ignore-codes && format('--ignore-codes={0}', inputs.ignore-codes) || '' }} IGNORE_WARNINGS: ${{ inputs.ignore-warnings == 'true' && '--ignore-warnings' || '' }} IGNORE_ERRORS: ${{ inputs.ignore-errors == 'true' && '--ignore-errors' || '' }} INCLUDE_EXPERIMENTAL: ${{ inputs.include-experimental == 'true' && '--include-experimental' || '' }}