]> khamidou — GitHub mirrors - arcanist.git/commit
Add C# linter for Arcanist.
authorJames Rhodes <jrhodes@redpointsoftware.com.au>
Tue, 1 Oct 2013 18:37:26 +0000 (11:37 -0700)
committerepriestley <git@epriestley.com>
Tue, 1 Oct 2013 18:37:26 +0000 (11:37 -0700)
commit02e4a690dda72871bfa87263456648586604b068
tree9a1fbccda4694b329ac1e797d816a3842bf2ce65
parent0b8ea973aed7c5d652823522befcf504b17f5d2b
Add C# linter for Arcanist.

Summary:
Completes T3859.  This implements a C# linter for Arcanist, which in turn uses `cslint` from `cstools` to actually perform the linting.  `cslint` internally uses StyleCop in addition to it's own lint rules.

Unlike other linters, C# is a compiled language, which means that the StyleCop integration must be aware of the full project.  To this end, there is the `discovery` setting in `.arclint`.  This allows users to define mappings between C# files and the projects they belong to.  Here is an configuration for `.arclint` (and is the one we use):

```
{
  "linters": {
    "csharp": {
      "type": "csharp",
      "include": "(\\.cs$)",
      "binary": "cstools/cslint/bin/Debug/cslint.exe",
      "discovery": {
        "([^/]+)/(.*?)\\.cs": [
          "$1/$1.Linux.csproj"
        ],
        "([^\\\\]+)\\\\(.*?)\\.cs": [
          "$1\\$1.Windows.csproj"
        ]
      }
    }
  }
}
```

Test Plan: Tested under both Linux and Windows.  Changed some files, ran `arc lint` and it all worked correctly.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran, jamesr
Maniphest Tasks: T3859

Differential Revision: https://secure.phabricator.com/D7170
src/__phutil_library_map__.php
src/lint/linter/ArcanistCSharpLinter.php [new file with mode: 0644]