yamllintphabricatorarcanist

How do I setup YAML linting in Arcanist?


I can't figure out how to do custom linting pre-diff in Arcanist (YAML, specifically). The instructions don't explain how to integrate a new linter into my existing .arclint configuration.


Solution

  • I figured this out on my own, and thought I'd share here in case anyone else has this issue.

    The following .arclint file does the trick:

    {
      "linters": {
        "yaml": {
          "type": "script-and-regex",
          "script-and-regex.script": "yamllint",
          "script-and-regex.regex": "/^(?P<line>\\d+):(?P<offset>\\d+) +(?P<severity>warning|error) +(?P<message>.*) +\\((?P<name>.*)\\)$/m",
          "include": "(\\.yml$)",
          "exclude": [ ]
        }
      }
    }
    

    I haven't extensively tried out that regex, but it works for my purposes so far.

    You can configure Yamllint by populating a .yamllint file in the repository root.