Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: make phpcs severity level configurable #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions coding-standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ jobs:
with:
version: 25 # Optional, will use the latest if omitted.
path: app/code # Optional, will be used when event is not a pull request.
severity: 8 # Optional, will use phpcs default of 5 if not specified.
warning_severity: 4 # Optional, will use severity value if not specified.
error_severity: 7 # Optional, will use severity value if not specified.
```
22 changes: 21 additions & 1 deletion coding-standard/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ inputs:
version:
required: false
description: "The version of the coding standard to use. If not provided, will use the latest version."

severity:
required: false
default: ""
description: "The minimum severity required to display an error or warning (default: 5)"

warning_severity:
required: false
default: ""
description: "The minimum severity required to display a warning"

error_severity:
required: false
default: ""
description: "The minimum severity required to display an error"

runs:
using: composite
Expand Down Expand Up @@ -61,5 +76,10 @@ runs:

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