Skip to content

Commit 81a1eb2

Browse files
authored
feat: make phpcs severity level configurable (#130)
Add inputs to allow configuring error and warning severity levels. This allows suppressing messages in the Mage-OS repository that are ignored in upstream Magento Open Source CI, too.
1 parent 5bbda33 commit 81a1eb2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

coding-standard/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ jobs:
2727
with:
2828
version: 25 # Optional, will use the latest if omitted.
2929
path: app/code # Optional, will be used when event is not a pull request.
30+
severity: 8 # Optional, will use phpcs default of 5 if not specified.
31+
warning_severity: 4 # Optional, will use severity value if not specified.
32+
error_severity: 7 # Optional, will use severity value if not specified.
3033
```

coding-standard/action.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ inputs:
2121
version:
2222
required: false
2323
description: "The version of the coding standard to use. If not provided, will use the latest version."
24+
25+
severity:
26+
required: false
27+
default: ""
28+
description: "The minimum severity required to display an error or warning (default: 5)"
29+
30+
warning_severity:
31+
required: false
32+
default: ""
33+
description: "The minimum severity required to display a warning"
34+
35+
error_severity:
36+
required: false
37+
default: ""
38+
description: "The minimum severity required to display an error"
2439

2540
runs:
2641
using: composite
@@ -61,5 +76,10 @@ runs:
6176

6277
- name: Coding Standard Check
6378
shell: bash
64-
run: ../standard/vendor/bin/phpcs --standard=Magento2 ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.files || inputs.path }}
79+
run: |
80+
../standard/vendor/bin/phpcs --standard=Magento2 \
81+
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
82+
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
83+
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
84+
${{ github.event_name == 'pull_request' && steps.changed-files.outputs.files || inputs.path }}
6585
working-directory: project

0 commit comments

Comments
 (0)