4

Here is what it says when I run arc linters --verbose:

AVAILABLE   csharp (C#)

Configuration Options

severity (optional map<string|int, string>)
  Provide a map from lint codes to adjusted severity levels: error,
  warning, advice, autofix or disabled.

severity.rules (optional map<string, string>)
  Provide a map of regular expressions to severity levels. All matching
  codes have their severity adjusted.

discovery (map<string, list<string>>)
  Provide a discovery map.

binary (string)
  Override default binary.

What is a discovery map? It doesn't tell you what it is, but you MUST have it. Unfortunately, the source code did not enlighten me.

binary... I don't want to override the default binary... What is the default binary? I HAVE to override it, so I need to get one? Where do I get a C# linter binary compatible with Arcanist? The only one I could find is https://github.com/hach-que/cstools, but it throws an exception.

Let me know if I can add more info.

Travis Rotz
  • 153
  • 1
  • 9

1 Answers1

2

cstools is the one you need;you can see this if you look into the ArcanistCSharpLinter.php, where it looks for cslint.exe as the default binary.

--- Edit ---

Not sure if you're looking at the right tool; the one being referred to is this one developed by hach-que, here: https://github.com/hach-que/cstools

I'm not super-familiar with this linter (don't do any serious C# development myself), but a quick peek in the source code suggests that the discovery map is simply a string map called "discovery", that has settings for the linter.

See also: https://github.com/hach-que/cstools/issues/1

Copy Pasting examples here since that seems to be SO policy:

Sample .arcconfig:

{
    "project_id": "Tychaia",
    "conduit_uri": "https://code.redpointsoftware.com.au/",
    "arc.autostash": true,
    "load": [
        "Build/Arcanist"
    ],
    "unit.engine": "XUnitTestEngine",
    "unit.csharp.xunit.binary": "packages/xunit.runners.1.9.1/tools/xunit.console.clr4.exe",
    "unit.csharp.cscover.binary": "cstools/cscover/bin/Debug/cscover.exe",
    "unit.csharp.coverage.match": "/^Tychaia.*\\.(dll|exe)$/",
    "unit.csharp.discovery": {
      "([^/]+)/(.*?)\\.cs": [
        [ "$1.Tests/$1.Tests.Linux.csproj", "$1.Tests/bin/Debug/$1.Tests.dll" ],
        [ "$1.Tests/$1.Tests.Windows.csproj", "$1.Tests/bin/Debug/$1.Tests.dll" ]
      ],
      "([^\\\\]+)\\\\(.*?)\\.cs": [
        [ "$1.Tests\\$1.Tests.Windows.csproj", "$1.Tests\\bin\\Debug\\$1.Tests.dll" ]
      ],
      "([^/]+)\\.Tests/(.*?)\\.cs": [
        [ "$1.Tests/$1.Tests.Linux.csproj", "$1.Tests/bin/Debug/$1.Tests.dll" ],
        [ "$1.Tests/$1.Tests.Windows.csproj", "$1.Tests/bin/Debug/$1.Tests.dll" ]
      ],
      "([^\\\\]+)\\.Tests\\\\(.*?)\\.cs": [
        [ "$1.Tests\\$1.Tests.Windows.csproj", "$1.Tests\\bin\\Debug\\$1.Tests.dll" ]
      ]
    }
}

Sample .arclint:

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

Anyway, if you're having trouble getting cstools to work, I'd recommend opening an issue on the Github repo; he seems to be pretty responsive. Plus, as an open-source developer, it's always great to hear that others are using your work.

Michael A.
  • 4,163
  • 3
  • 28
  • 47
  • What about the discovery map? What needs to be provided there? – LavaHot Jul 21 '15 at 23:33
  • Sorry I can't still understand the discovery map. If we already include/exclude files above, what does discovery do and why is it mandatory? – nhenrique Jul 07 '16 at 13:29
  • Contact hach-que. The cslint-based linter has since been deprecated. See https://secure.phabricator.com/T8978 – Michael A. Jul 08 '16 at 23:54