HomePhabricator

Modify the `lint-test` file format to allow for more powerful assertions

Authored by joshuaspence on May 21 2019, 1:27 AM.

Description

Modify the lint-test file format to allow for more powerful assertions

Summary:
Fixes T6854. The current format for lint-test files is somewhat inflexible and does not allow us to make assertions regarding the code or name of the linter messages (of class ArcanistLintMessage) that are raised. Specifically, the ${severity}:${line}:${char} format is hardcoded in ArcanistLinterTestCase. In this diff, I extend the this format to achieve the following goals:

  • Allow for the lint message code and name to be specified. Specifically, the full format is ${severity}:${line}:${char}:${code}:${name}.
  • Make all fields optional. error:3: will match any and all errors occuring on line 3.
  • Provide more useful output when assertions fail. Specifically, output all lint messages that are missing and/or surplus. Previously, only the first lint message was output.

Test Plan: arc unit

Reviewers: Blessed Reviewers, epriestley, chad

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6854

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