-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: Allow custom phpcs coding standard #149
base: main
Are you sure you want to change the base?
Changes from all commits
1b28742
ef7a0a2
9911ee6
478d81f
6c6aebc
272d75f
76ca691
e8d20c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,17 +21,17 @@ 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: "" | ||
|
@@ -42,6 +42,16 @@ inputs: | |
default: 'false' | ||
required: false | ||
|
||
coding_standard: | ||
description: 'The coding standard to use, defaults to Magento2' | ||
default: 'Magento2' | ||
required: false | ||
|
||
custom_coding_standard_repo: | ||
description: 'The repository to use for the coding standard, used if you want to use a custom coding standard' | ||
default: '' | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
|
@@ -79,15 +89,21 @@ runs: | |
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global | ||
if: steps.is-allow-plugins-available.outputs.result < 1 | ||
|
||
- name: Install Coding Standard | ||
- name: Install composer require dealerdirect/phpcodesniffer-composer-installer | ||
shell: bash | ||
working-directory: standard | ||
run: composer require dealerdirect/phpcodesniffer-composer-installer | ||
|
||
- name: Install Magento2 Coding Standard | ||
shell: bash | ||
working-directory: standard | ||
run: composer require "magento/magento-coding-standard:${{ inputs.version || '*' }}" | ||
|
||
- name: Register Coding Standard | ||
- name: Install Custom Coding Standard | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I foresee two situations for this action to be used:
both of them will often have this extra repo already included in I don't personally think |
||
if: ${{ inputs.custom_coding_standard_repo }} | ||
shell: bash | ||
working-directory: standard | ||
run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/standard/vendor/magento/magento-coding-standard,${{ github.workspace }}/standard/vendor/phpcompatibility/php-compatibility | ||
run: composer require "${{ inputs.custom_coding_standard_repo }}" | ||
|
||
- name: Set ignore warnings flag | ||
shell: bash | ||
|
@@ -105,7 +121,8 @@ runs: | |
- name: Coding Standard Check | ||
shell: bash | ||
run: | | ||
../standard/vendor/bin/phpcs --standard=Magento2 \ | ||
../standard/vendor/bin/phpcs \ | ||
--standard="${{ inputs.coding_standard }}" \ | ||
$([ -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 }}") \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these two things (the custom standard install and the Magento standard install) mutually exclusive? Wouldn't
custom_standard
have a dep on Magento?