Page MenuHomePhabricator

[LINTER] Enforce custom coding standard for PHP files
ClosedPublic

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

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABCdb99036786ac: [LINTER] Enforce custom coding standard for PHP files
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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Apr 2 2019, 12:54
Herald added a reviewer: Restricted Project. · View Herald TranscriptApr 2 2019, 12:54
Herald added a subscriber: schancel. · View Herald Transcript
Fabien updated this revision to Diff 7939.Apr 4 2019, 07:32

Exclude comment blocks from strict alignment

Fabien updated this revision to Diff 7960.Apr 5 2019, 10:14

Exclude object operator from the strict indentation check

Fabien added inline comments.Apr 5 2019, 10:22
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.

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