]> khamidou — GitHub mirrors - arcanist.git/commit
Add a linter rule for logical operators
authorJoshua Spence <josh@joshuaspence.com>
Sun, 12 Apr 2015 21:34:17 +0000 (07:34 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Sun, 12 Apr 2015 21:35:38 +0000 (07:35 +1000)
commitb11757fa23a5ddb5220f990e88bdb790d7242032
tree42b4488f2fba2ccf7eacc2f51363707b1a96e26e
parentfc70dfe268f81e7028ef5655801bb468d7b8fc9e
Add a linter rule for logical operators

Summary:
Ref T7409. Adds `ArcanistXHPASTLinter::LINT_LOGICAL_OPERATORS` for advising:

  - `&&` in favor of `and`.
  - `||` in favor of `or`.

Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/Operators/ValidLogicalOperatorsSniff.php | Squiz_Sniffs_Operators_ValidLogicalOperatorsSniff]].

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12376
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/logical-operators.lint-test [new file with mode: 0644]