Closed harunollyo closed 1 year ago
@10up/open-source-practice can someone please help chime in here?
Hi @harunollyo,
You can use a project ruleset by creating file named phpcs.xml.dist
in the root directory of your project, it should contain something like the following:
<?xml version="1.0"?>
<ruleset name="Project Rules">
<rule ref="WordPress">
<!-- Any of `WordPress|WordPress-Core|WordPress-Docs|WordPress-Extra|WordPress-VIP-Go|WordPressVIPMinimum|10up-Default` -->
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>
</ruleset>
When setting up your workflow, use the use_local_config
argument to specify the use of your repos file:
- name: WPCS check
uses: 10up/wpcs-action@stable
with:
standard: 'WordPress' # Standard to use. Accepts WordPress|WordPress-Core|WordPress-Docs|WordPress-Extra|WordPress-VIP-Go|WordPressVIPMinimum|10up-Default.
use_local_config: 'true' # Use local config if available
Updating this for us to update the docs to call out this sort of example
Just want to add to the doc that they need to add repo_branch
parameter if you're trying to process a specific branch because without this parameter, it defaults to the master
or main
branch:
Here's mine with the refactor
branch:
name: WPCS check
on:
pull_request:
push:
branches:
- refactor
jobs:
phpcs:
name: WPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: WPCS check
uses: 10up/wpcs-action@stable
with:
standard: 'WordPress|WordPress-Extra|10up-Default'
use_local_config: 'true'
repo_branch: 'refactor'
@champsupertramp that's helpful, thanks! Mind opening a PR to edit the docs to note that?
I want to exclude these rules given below but did not find any option to pass it to GitHub action.
I have tried with this but it did not work.
Code of Conduct