]> khamidou — GitHub mirrors - arcanist.git/commit
Improve the "self member reference" linter rule
authorJoshua Spence <josh@freelancer.com>
Tue, 22 Dec 2015 21:39:44 +0000 (08:39 +1100)
committerJoshua Spence <josh@freelancer.com>
Tue, 22 Dec 2015 21:39:44 +0000 (08:39 +1100)
commit9ee14d28490c32151b98f21c2371454a3aae77a2
tree23660a24ea63c99fd2fb8cc32e089ae04a30a16d
parent8762e3f36715875605a205326bee7bae1f7eb481
Improve the "self member reference" linter rule

Summary:
Extends `ArcanistSelfMemberReferenceXHPASTLinterRule` to warn about the use of a hardcoded class name instead of `self` when instantiating a class. Arguably, we should maybe rename the linter rule from `ArcanistSelfMemberReferenceXHPASTLinterRule` to `ArcanistSelfUsageXHPASTLinterRule`, or even maybe split this rule into three separate rules:

  - `ArcanistSelfMemberReferenceXHPASTLinterRule`
  - `ArcanistSelfSpacingXHPASTLinterRule`
  - `ArcanistSelfClassReferenceXHPASTLinterRule`.

Test Plan: Added to existing test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13935
15 files changed:
src/__phutil_library_map__.php
src/lint/linter/xhpast/rules/ArcanistKeywordCasingXHPASTLinterRule.php
src/lint/linter/xhpast/rules/ArcanistPaamayimNekudotayimSpacingXHPASTLinterRule.php [new file with mode: 0644]
src/lint/linter/xhpast/rules/ArcanistSelfClassReferenceXHPASTLinterRule.php [new file with mode: 0644]
src/lint/linter/xhpast/rules/ArcanistSelfMemberReferenceXHPASTLinterRule.php
src/lint/linter/xhpast/rules/__tests__/ArcanistPaamayimNekudotayimSpacingXHPASTLinterRuleTestCase.php [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/ArcanistSelfClassReferenceXHPASTLinterRuleTestCase.php [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/keyword-casing/parent.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/keyword-casing/self.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/paamayim-nekudotayim-spacing/comment.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/paamayim-nekudotayim-spacing/newline.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/paamayim-nekudotayim-spacing/paamayim-nekudotayim-spacing.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/self-class-reference/self-class-references.lint-test [new file with mode: 0644]
src/lint/linter/xhpast/rules/__tests__/self-member-reference/php54.lint-test
src/lint/linter/xhpast/rules/__tests__/self-member-reference/self-member-reference.lint-test