How to get C # Arcanist linter?

This 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 what do I need to get it? Where can I get an Arcanist compatible C # linter binary? The only one I could find was https://github.com/hach-que/cstools , but it throws an exception.

Let me know if I can add more information.

+3


source to share


1 answer


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

--- Edit ---

Not sure if you are looking at the right tool; the one in question is the one developed by hach-que, here: https://github.com/hach-que/cstools

I'm not very familiar with this linter (don't do some serious C # development yourself), but a quick look in the source code suggests that the discovery map is just 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 as it looks like SO policy:



Example .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" ]
      ]
    }
}

      

Example .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 have any problems with cstools, I would recommend opening the issue in the Github repository; he seems to be very responsive. Plus, as an open source developer, it's always good to hear others use your work.

+1


source







All Articles