]>
khamidou — GitHub mirrors - arcanist.git/commit
Add "ArcanistSingleLintEngine" and "ArcanistScriptAndRegexLinter"
Summary:
Request from @csilvers. Allow installs to get most linter features with regexes, configuration and external scripts if they are hesitant to write phutil libraries.
- Add "ArcanistSingleLintEngine", which implements the smallest possible engine behavior (run one linter on every path).
- Add "ArcanistScriptAndRegexLinter", which uses a script and a regex to parse lint output from other scripts.
Depends on D2618.
Test Plan:
Basics:
$ arc set-config lint.engine ArcanistSingleLintEngine
Set key 'lint.engine' = 'ArcanistSingleLintEngine'.
$ arc set-config lint.engine.single.linter ArcanistScriptAndRegexLinter
Set key 'lint.engine.single.linter' = 'ArcanistScriptAndRegexLinter'.
$ arc set-config linter.scriptandregex.script 'echo derp #'
Set key 'linter.scriptandregex.script' = 'echo derp #'.
$ arc set-config linter.scriptandregex.regex '/^(?P<message>.*)$/m'
Set key 'linter.scriptandregex.regex' = '/^(?P<message>.*)$/m'.
$ arc lint
>>> Lint for .arcconfig:
Error (S&RX) Lint
derp
1 {
2 "project_id" : "arcanist",
3 "conduit_uri" : "https://secure.phabricator.com/",
Throw:
$ arc set-config linter.scriptandregex.regex '/^(?P<throw>.*)$/m'
Set key 'linter.scriptandregex.regex' = '/^(?P<throw>.*)$/m' (was '/^(?P<message>.*)$/m').
$ arc lint
Usage Exception: ArcanistScriptAndRegexLinter: configuration captured a 'throw' named capturing group, 'derp'. Script output:
derp
Ignore:
$ arc set-config linter.scriptandregex.regex '/^(?P<ignore>.*)$/m'
Set key 'linter.scriptandregex.regex' = '/^(?P<ignore>.*)$/m' (was '/^(?P<throw>.*)$/m').
$ arc lint
OKAY No lint warnings.
Severity:
$ arc set-config linter.scriptandregex.regex '/^(?P<warning>.)(?P<message>.*)$/m'
Set key 'linter.scriptandregex.regex' = '/^(?P<warning>.)(?P<message>.*)$/m' (was '/^(?P<ignore>.*)$/m').
$ arc lint
>>> Lint for src/lint/engine/single/ArcanistSingleLintEngine.php:
Warning (S&RX) Lint
erp
1 <?php
2
3 /*
Reviewers: csilvers, btrahan, vrana
Reviewed By: csilvers
CC: aran
Differential Revision: https://secure.phabricator.com/D2619