HomePhabricator

Test XHPAST linter rules in isolation

Description

Test XHPAST linter rules in isolation

Summary:
Separate XHPAST linter rules in isolation from other rules and formalize the concept of a "linter rule". As the number of XHPAST linter rules grows (we currently have around 80), it becomes increasingly difficult to manage all of the test cases because ArcanistXHPASTLinterTestCase currently tests the entire linter (i.e. all linter rules) rather than testing individual rules in isolation. See D13534 for a situation in which this is painful. This is particularly bad for third party development because unit tests could break at any time depending on upstream changes.

Basically, in order to facilitate the unit testing of XHPAST linter rules in isolation, I have made the following changes:

  1. Added a setRules() method to ArcanistXHPASTLinter. Currently, ArcanistXHPASTLinter loads all ArcanistXHPASTLinterRule subclasses unconditionally. The setRules() method provides a way to override the configured linter rules.
  2. Formalize the concept of a "linter rule". The ArcanistXHPASTLinterRule class was introduced in D10541. I feel that the modularization of ArcanistXHPASTLinter has made the linter much more maintainable and easily testable and I intend to extend this concept to other linters, such as ArcanistTextLinter.

Test Plan: Ran unit tests.

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14010

Details

Provenance
joshuaspenceAuthored on
joshuaspencePushed on Nov 18 2015, 9:57 PM
Reviewer
Blessed Reviewers
Differential Revision
D14010: Test XHPAST linter rules in isolation
Parents
rARCe3e232530c6e: Fix brace formatting linter rule after XHPAST changes
Branches
Unknown
Tags
Unknown
Build Status
Buildable 8918
Build 10453: Run Core Tests