Skip to content

dterei/sclinter

Repository files navigation

sclinter

Build Status GitHub release Test Coverage Codacy Grade

sclinter is a scala.meta based linter which aims to eventually encode Rubrik's scala formatting guide completely.

sclinter provides both a .jar file, and a .js file that produces lint output in JSON format directly consumable by external-json-linter for arcanist.

Installation

and extract it in a folder, say /usr/local/lib/sclinter

Load the linter in .arcconfig

{
  "project_id": "my-awesome-project",
  "conduit_uri": "https://example.org",

  "load": [
    "/usr/local/lib/sclinter/lint"
  ]
}

Add the linter to .arclint (invoked with JVM, runs faster)

{
  "linters": {
    "scala-linter": {
      "type": "external-json",
      "include": "(\\.scala$)",
      "external-json.script": "java -jar /usr/local/lib/sclinter/sclinter.jar $1"
    }
  }
}

Or, add the linter to .arclint (invoked with node, slower)

{
  "linters": {
    "scala-linter": {
      "type": "external-json",
      "include": "(\\.scala$)",
      "external-json.script": "node /usr/local/lib/sclinter/sclinter.js $1"
    }
  }
}

Configuration

Disabling sclinter for a particular line

Add one of sclinter:off, nolint, noqa, lint:off as a comment to the line, where you want to ignore lint errors.

Example:
// The type of the following function is a mouthful, and doesn't
// help in documentation even if written out explicitly.
def complexTypedFunction = { // nolint
  implementation
}

// You can add short explanations after the comment too
if(condition){ // lint:off I know I'm messing with whitespace, <explanation>.
  awesomeStuff()
}

Development

Install sbt by following the installation guide

git clone https://github.com/scaledata/sclinter.git
cd sclinter

# build
sbt sclinterJVM/assembly # builds the jar
sbt sclinterJS/fastOptJS # builds the JS file

# only test
sbt test

About

scala.meta based linter

Resources

Stars

Watchers

Forks

Packages

No packages published