GitHub Action
PHP CS for Magento 2 GitHub Actions
This repository's aim is to provide open sourced GitHub action to develop better Magento 2 extensions.
name: M2 Coding Standard
on:
push:
pull_request:
branches:
- "*"
jobs:
static:
name: Magento 2 Coding Standard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: M2 code standard
id: magento
uses: aNereds/magento2-coding-standard@master
with:
fileExtensions: "php,phtml,xml"
onlyErrors: "no"
sourceReport: "yes"
- name: Get the output time
run: echo "Action Output, ${{ steps.magento.outputs.time }}"
By default, PHP_CodeSniffer will check any file it finds with a .inc, .php, .js or .css extension, although not all standards will actually check all these file types. Sometimes, this means that PHP_CodeSniffer is not checking enough of your files. Sometimes, the opposite is true. To specify file extensions can be added separated by coma to override default values
....
with:
fileExtensions: "php,phtml,xml" - ### Here can be specified file extensions for validation
onlyErrors: "yes"
sourceReport: "yes"
....
If you don't want warnings included in the output, specify the -n command line argument. By following coding-standard.yml file adjustments.
....
with:
fileExtensions: "php,phtml,xml"
onlyErrors: "yes" - ### This flag should be set to yes
sourceReport: "yes"
....
By default, PHP_CodeSniffer will print a complete list of all errors and warnings it finds. This list can become quite long, especially when checking a large number of files at once. To print a summary report that only shows the number of errors and warnings for each file, use the sourceReport: "yes" set to yes.
....
with:
fileExtensions: "php,phtml,xml"
onlyErrors: "no"
sourceReport: "yes" - ### This flag should be set to yes
....