Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Oct 14, 2021
2 parents 4e34786 + 4a53f65 commit 614876e
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 104 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/orca.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
name: ORCA CI
on:
push:
branches: [ master, develop, wip ]
pull_request:
branches: [ master, develop, wip ]
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allow-failure }}
env:
ORCA_SUT_NAME: acquia/coding-standards
ORCA_SUT_BRANCH: master
ORCA_VERSION: dev-develop
ORCA_TELEMETRY_ENABLE: TRUE
ORCA_JOB: ${{ matrix.orca-job }}

strategy:
matrix:
orca-job:
- STATIC_CODE_ANALYSIS
- INTEGRATED_TEST_ON_OLDEST_SUPPORTED
- INTEGRATED_TEST_ON_LATEST_LTS
- INTEGRATED_TEST_ON_PREVIOUS_MINOR
- INTEGRATED_UPGRADE_TEST_FROM_PREVIOUS_MINOR
- ISOLATED_TEST_ON_CURRENT
- INTEGRATED_TEST_ON_CURRENT
- INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR
- ISOLATED_TEST_ON_CURRENT_DEV
- INTEGRATED_TEST_ON_CURRENT_DEV
- STRICT_DEPRECATED_CODE_SCAN
- ISOLATED_TEST_ON_NEXT_MINOR
- INTEGRATED_TEST_ON_NEXT_MINOR
- ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_BETA_OR_LATER
php-version: [ "7.3" ]
allow-failure: [ false ]
include:
- orca-job: ISOLATED_TEST_ON_CURRENT
php-version: "8.0"
allow-failure: false

- orca-job: INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR_DEV
php-version: "7.3"
allow-failure: true

- orca-job: LOOSE_DEPRECATED_CODE_SCAN
php-version: "7.3"
allow-failure: true

- orca-job: DEPRECATED_CODE_SCAN_W_CONTRIB
php-version: "7.3"
allow-failure: true

- orca-job: ISOLATED_TEST_ON_NEXT_MINOR_DEV
php-version: "7.3"
allow-failure: true

- orca-job: INTEGRATED_TEST_ON_NEXT_MINOR_DEV
php-version: "7.3"
allow-failure: true

- orca-job: ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_DEV
php-version: "7.3"
allow-failure: true

# Custom job
- php-version: "7.3"

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 12.x

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug2

- name: Before install
run: |
composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION"
../orca/bin/ci/before_install.sh
- name: Install
run: |
../orca/bin/ci/install.sh
./bin/travis/install.sh
- name: Before script
run: ../orca/bin/ci/before_script.sh

- name: Script
run: ./bin/travis/script.sh

- name: After script
run: ../orca/bin/ci/after_script.sh

- name: After success
if: ${{ success() }}
run: ../orca/bin/ci/after_success.sh

- name: After failure
if: ${{ failure() }}
run: ../orca/bin/ci/after_failure.sh
89 changes: 0 additions & 89 deletions .travis.yml

This file was deleted.

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Acquia Coding Standards for PHP includes a selection of sniffs from the followin
Rules are split into rulesets according to the project language and framework:

* [AcquiaPHP](src/Standards/AcquiaPHP/ruleset.xml) contains sniffs applicable to all PHP projects.
* [AcquiaDrupalStrict](src/Standards/AcquiaDrupalStrict/ruleset.xml) incorporates AcquiaPHP and adds all Drupal coding standards and best practices sniffs. It is recommended for new Drupal projects and teams familiar with Drupal coding standards.
* [AcquiaDrupalTransitional](src/Standards/AcquiaDrupalTransitional/ruleset.xml) provides a relaxed standard for legacy Drupal codebases or teams new to Drupal coding standards. It incorporates AcquiaPHP and adds a more or less straight copy of Drupal core's own phpcs configuration, making it sufficient for core contribution.
* [AcquiaDrupalStrict](src/Standards/AcquiaDrupalStrict/ruleset.xml) incorporates AcquiaPHP and adds all Drupal coding standards and best practices sniffs. Recommended for new Drupal projects and teams familiar with Drupal coding standards.
* [AcquiaDrupalTransitional](src/Standards/AcquiaDrupalTransitional/ruleset.xml) incorporates AcquiaPHP and adds Drupal core's own phpcs configuration, which is less strict than the official standards. Recommended for legacy Drupal codebases or teams new to Drupal coding standards.
* [AcquiaEdge](src/Standards/AcquiaEdge/ruleset.xml) incorporates AcquiaPHP and adds backwards-incompatible sniffs that will be included in AcquiaPHP with the next major release of this package.

## Installation & usage

Expand Down Expand Up @@ -57,20 +58,24 @@ Rules are split into rulesets according to the project language and framework:
1. Check code for standards compliance:

```bash
./vendor/bin/phpcs --standard=AcquiaDrupalStrict path/to/code
./vendor/bin/phpcs --standard=AcquiaDrupalStrict --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml path/to/code
```

Automatically fix any standards violations possible:

```bash
./vendor/bin/phpcbf --standard=AcquiaDrupalStrict path/to/code
./vendor/bin/phpcbf --standard=AcquiaDrupalStrict --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml path/to/code
```

The `--extensions` argument must match the chosen code standard. For AcquiaPHP, use `--extensions=php,inc,test,css,txt,md,yml`.

1. Optionally create a [default configuration file](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file) for your project so you don't have to provide the command-line arguments every time (i.e., below). Here's a working example: [`example/phpcs.xml.dist`](example/phpcs.xml.dist).

```bash
./vendor/bin/phpcs
```

Modify `phpcs.xml.dist` to suit your project, especially to set the preferred code standard and matching extensions.

1. Optionally add code checking to your [Git pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to prevent committing code with violations. Since client-side Git hooks are not copied when a repository is cloned, you might like to use an automated solution like [`BrainMaestro/composer-git-hooks`](https://packagist.org/packages/BrainMaestro/composer-git-hooks) to manage them, for example: [`example/composer.json`](example/composer.json).

Expand Down
14 changes: 9 additions & 5 deletions example/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@

<description>An example PHP CodeSniffer configuration.</description>

<!-- Set extensions to scan (taken from Coder 8.3.6). -->
<!-- @see https://git.drupalcode.org/project/coder/blob/8.3.6/coder_sniffer/Drupal/ruleset.xml#L8 -->
<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>
<!-- Uncomment your chosen standard and the filename extensions corresponding to it. -->
<!-- @see https://github.com/acquia/coding-standards-php/issues/18 for background on filename extensions. -->
<rule ref="AcquiaDrupalStrict"/><arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>
<!-- <rule ref="AcquiaDrupalTransitional"/><arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/> -->
<!-- <rule ref="AcquiaPHP"/><arg name="extensions" value="php,inc,test,css,txt,md,yml"/> -->
<!-- <rule ref="AcquiaEdge"/><arg name="extensions" value="php,inc,test,css,txt,md,yml"/> -->

<arg name="colors"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="parallel" value="10"/>

<file>.</file>

<!-- Danger! Exclude patterns apply to the full file path, including parent directories of the current repository. -->
<!-- Don't exclude common directory names like `build`, which would fail on Travis CI because of /home/travis/build/acquia/<project>. -->
<!-- @see https://github.com/squizlabs/PHP_CodeSniffer/issues/981 -->
<exclude-pattern>vendor/*</exclude-pattern>

<rule ref="AcquiaDrupalStrict"/>

</ruleset>
2 changes: 0 additions & 2 deletions src/Standards/AcquiaDrupalStrict/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<description>Acquia's strict Drupal coding standards.</description>

<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>

<!-- Drupal sniffs -->
<rule ref="Drupal">
<exclude name="Drupal.Files.TxtFileLineLength.TooLong"/>
Expand Down
2 changes: 0 additions & 2 deletions src/Standards/AcquiaDrupalTransitional/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<description>Acquia's transitional Drupal coding standards.</description>

<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>

<!-- Drupal sniffs -->
<rule ref="Drupal">
<exclude name="Drupal.Files.TxtFileLineLength.TooLong"/>
Expand Down
19 changes: 19 additions & 0 deletions src/Standards/AcquiaEdge/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset -->
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/squizlabs/php_codesniffer/phpcs.xsd"
name="AcquiaEdge"
>

<description>Acquia's Edge (backwards-incompatible) coding standards.</description>

<arg name="extensions" value="php,inc,test,css,txt,md,yml"/>

<!-- SlevomatCodingStandard sniffs -->
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable" />

<!-- Acquia PHP sniffs -->
<rule ref="AcquiaPHP"/>

</ruleset>
2 changes: 0 additions & 2 deletions src/Standards/AcquiaPHP/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<description>Acquia's PHP coding standards.</description>

<arg name="extensions" value="php,inc,test,css,txt,md,yml"/>

<!-- Drupal sniffs -->
<rule ref="Drupal.WhiteSpace.ScopeIndent"/>

Expand Down

0 comments on commit 614876e

Please sign in to comment.