-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: phpcs | ||
|
||
on: [push] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
extensions: mbstring, fileinfo | ||
coverage: none | ||
tools: cs2pr | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ env.php-versions }}-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ env.php-versions }}- | ||
${{ runner.os }}-composer- | ||
- name: Check Version | ||
run: php -v && php -m && composer -V | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Install dependencies (composer.lock) | ||
run: composer install --no-interaction --prefer-dist --no-progress | ||
|
||
- name: Run phpcs fix | ||
run: vendor/bin/phpcs --report=checkstyle -q | cs2pr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
<description>The coding standard for PHP_CodeSniffer itself.</description> | ||
|
||
<file>driver</file> | ||
<file>src</file> | ||
|
||
<arg name="basepath" value="."/> | ||
<arg name="extensions" value="php" /> | ||
<arg name="colors"/> | ||
<arg name="parallel" value="75"/> | ||
<!-- -n 忽略警告,-w 打印警告 --> | ||
<arg value="nsp"/> | ||
|
||
<!-- Don't hide tokenizer exceptions --> | ||
<rule ref="Internal.Tokenizer.Exception"> | ||
<type>error</type> | ||
</rule> | ||
|
||
<rule ref="PSR12"> | ||
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/> | ||
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/> | ||
<exclude name="PSR2.Classes.PropertyDeclaration.SpacingAfterType"/> | ||
</rule> | ||
|
||
<rule ref="PSR12.Classes.ClassInstantiation.MissingParentheses"> | ||
<type>warning</type> | ||
</rule> | ||
|
||
<rule ref="Generic.Formatting.MultipleStatementAlignment"> | ||
<type>warning</type> | ||
</rule> | ||
|
||
<!-- Ban some functions --> | ||
<rule ref="Generic.PHP.ForbiddenFunctions"> | ||
<properties> | ||
<property name="forbiddenFunctions" type="array"> | ||
<element key="sizeof" value="count"/> | ||
<element key="delete" value="unset"/> | ||
<element key="create_function" value="null"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
|
||
</ruleset> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters