]> khamidou — GitHub mirrors - arcanist.git/commit
Lay groundwork for configuration-driven linters
authorepriestley <git@epriestley.com>
Thu, 22 Aug 2013 23:02:16 +0000 (16:02 -0700)
committerepriestley <git@epriestley.com>
Thu, 22 Aug 2013 23:02:16 +0000 (16:02 -0700)
commit97ad54ed0053595ec76fd1fab575c35b1732a1c0
treeb01524c1f808c6b0413d400d66dfb832f2190654
parent5eb82c8e7d6dbe8b60d3da3ac04fcfd4472b9f3a
Lay groundwork for configuration-driven linters

Summary:
Ref T2039. That task has a bunch of discussion, but basically we do a poor job of serving the midrange of lint configuration right now.

If you have something simple, the default linters work.

If you have something complex, building your own engine lets you do whatever you want.

But many users want something in between, which isn't really well accommodated. The idea is to let you write a `.arclint` file, which looks something like this:

  {
   "linters" : {
      "css" : {
        "type" : "csslint",
        "include" : "(\.css$)",
        "exclude" : "(^externals/)",
        "bin" : "/usr/local/bin/csslint"
      },
      "js" : {
        "type" : "jshint",
        "include" : "(\.js$)",
        "exclude" : "(^externals/)",
        "bin" : "support/bin/jshint",
        "interpreter" : "/usr/local/bin/node"
      }
   }
  }

...which will provide a bunch of common options around lint severity, interpreter and binary locaitons, included and excluded files, etc.

This implements some basics, and very rough support in the Filename linter.

Test Plan:
Generated a `.arclint` file and saw it apply filename lint correctly. Used `debug` mode and tried invalid regexps.

  {
    "debug" : true,
    "linters" : {
      "filename" : {
        "type" : "filename",
        "exclude" : ["@^externals/@"]
      }
    }
  }

Next steps include:

  - Provide an external linter archetype (T3186) and expose a common set of configuration here ("bin", "interpreter", "flags", "severity").
  - Provide a `.arcunit` file which works similarly (it can probably be simpler).

Reviewers: btrahan, Firehed

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D6797
src/__phutil_library_map__.php
src/lint/engine/ArcanistConfigurationDrivenLintEngine.php [new file with mode: 0644]
src/lint/linter/ArcanistConduitLinter.php
src/lint/linter/ArcanistFilenameLinter.php
src/lint/linter/ArcanistLinter.php
src/workflow/ArcanistLintWorkflow.php
src/workingcopyidentity/ArcanistWorkingCopyIdentity.php