linter-scalac Archived: ... Source Code has been archived

Lint Scala on the fly, using scalac. Also possible to use other Scala linters, such as WartRemover, via compiler options.

AtomLinter

35,845

41

2.0.1

MIT

GitHub

This package provides the following services:

linter-scalac

Circle CI Status Travis CI Status AppVeyor Status

Lint Scala using scalac.

Installation

$ apm install linter-scalac

Configuration

Via config.json:

'linter-scalac':

  # Execute `which scala` to determine your own path.
  # By default the scalac binary is resolved from your path.
  'scalacExecutablePath': 'scalac'

  # Execute `scalac -X` and `scalac -Y` for a handful of useful options.
  'scalacOptions': '-Xlint -P:wartremover:traverser:org.brianmckenna.wartremover.warts.Unsafe'

  # Write the compiled classes to the location specified in .classpath
  'compileClassesToClasspath': false

  # Compile all Scala files in the project on lint.
  'compileAllClassesOnLint': false

  # Determines if lints on every change or lint on save only.
  'lintsOnChange': false

It is also possible to configure these settings via the GUI:

Atom > Preferences > linter-scalac

Lint on change

It is disabled by default because the scala compiler is slow but you can change it via configuration option. Keep in mind that this option does not override the global linter 'Lint on change' configuration option.

Classpath

It is strongly recommended that you utilize a .classpath file in the root of your project. While linter-scalac will work without it, you will be given numerous invalid errors and warnings due to the lack of a proper classpath passed to scalac. The .classpath file should simply contain the project's full classpath, which is easily generated via SBT:

sbt 'export fullClasspath'

Notes

  1. If your SBT project uses a multi-project setup, you will need a .classpath for each subproject.

  2. If your SBT project uses a multi-project setup, you cannot use the project root as the Atom project. You must treat each SBT subproject as its own Atom project.

  3. It is assumed that the first path in .classpath is your compiled classes directory (the SBT command above does this automatically). Assuming this is true, it will play nice with SBT. Performing SBT tasks will update linter-scalac compiled files and vice-versa.