Page MenuHomePhabricator

[LINTER] Enforce custom coding standard for PHP files
ClosedPublic

Authored by Fabien on Apr 2 2019, 12:54.

Details

Summary

These rules are close to Pḧabricator standard.
Requires the installation of phpcs on the local machine.

Depends on D2760

Test Plan

Should return no error:

arc lint -- arcanist/linter*

Add a tab at the beginning of a line in any of the
arcanist/linter/*.php file, then:

arc lint -- arcanist/linter*

The error should be reported.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Exclude comment blocks from strict alignment

Exclude object operator from the strict indentation check

arcanist/linter/phpcs_ruleset.xml
41 ↗(On Diff #7960)

Note to reviewers: theses 2 tokens are exception to the indentation check.
They are excluded because there is no built-in rule in any standard that enforce:

  • Multiline comment stars alignment (only doc comments are supported):
/*
 * Comment with aligned stars
 */
  • Multiline statement indentation when outside of a function, array or control structure.

These rules need to be enforced in their own PHP sniffer scripts, which may better be added in other diffs.
These exceptions ensure that the produced code can still be compliant with our rules.

This revision is now accepted and ready to land.Apr 15 2019, 11:52
This revision was automatically updated to reflect the committed changes.