Skip to content
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

Fix #9: Disallow superglobal variables #28

Merged
merged 4 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 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
1 change: 1 addition & 0 deletions example/phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<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"/>
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>