Home GnuPG

Test XHPAST linter rules in isolation
4d512c51d43cUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

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
Joshua Spence <josh@joshuaspence.com>Authored on Nov 18 2015, 10:57 PM
Joshua Spence <josh@freelancer.com>Committed on Nov 18 2015, 10:57 PM
Parents
rARCe3e232530c6e: Fix brace formatting linter rule after XHPAST changes
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@freelancer.com> committed rARC4d512c51d43c: Test XHPAST linter rules in isolation (authored by Joshua Spence <josh@joshuaspence.com>).Nov 18 2015, 10:57 PM