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.
and extract it in a folder, say /usr/local/lib/sclinter
{
"project_id": "my-awesome-project",
"conduit_uri": "https://example.org",
"load": [
"/usr/local/lib/sclinter/lint"
]
}
{
"linters": {
"scala-linter": {
"type": "external-json",
"include": "(\\.scala$)",
"external-json.script": "java -jar /usr/local/lib/sclinter/sclinter.jar $1"
}
}
}
{
"linters": {
"scala-linter": {
"type": "external-json",
"include": "(\\.scala$)",
"external-json.script": "node /usr/local/lib/sclinter/sclinter.js $1"
}
}
}
Add one of sclinter:off
, nolint
, noqa
, lint:off
as
a comment to the line, where you want to ignore lint errors.
// 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()
}
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