SublimeLinter-contrib-scalac
SublimeLinter 3 plugin for Scala, using scalac
Details
Installs
- Total 2K
- Win 773
- Mac 964
- Linux 565
Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | Aug 25 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
SublimeLinter-contrib-scalac
This linter plugin for SublimeLinter provides an interface to scalac. It will be used with files that have the “scala” syntax.
IMPORTANT!
Please note that because scalac
requires a complete directory context in
order to work, this linter plugin currently will only lint a file when it has
been saved. As soon as you modify the file, all linter marks will be cleared.
Installation
SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions here.
Linter installation
Before using this plugin, you must ensure that scalac
is installed on your
system. scalac
is part of the scala
developer SDK, which can be downloaded
here.
Note: This plugin requires Scala 2.9.1 or later.
Linter configuration
In order for scalac
to be executed by SublimeLinter, you must ensure that its
path is available to SublimeLinter. Before going any further, please read and
follow the steps in “Finding a linter executable” through
“Validating your PATH” in the documentation.
Once you have installed and configured scalac
, you can proceed to install the
SublimeLinter-contrib-scalac plugin if it is not yet installed.
Plugin installation
Please use Package Control to install the linter plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here.
To install via Package Control, do the following:
Within Sublime Text, bring up the Command Palette and type
install
. Among the commands you should seePackage Control: Install Package
. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins.When the plugin list appears, type
scalac
. Among the entries you should seeSublimeLinter-contrib-scalac
. If that entry is not highlighted, use the keyboard or mouse to select it.
Settings
For general information on how SublimeLinter works with settings, please see Settings. For information on generic linter settings, please see Linter Settings.
In addition to the standard SublimeLinter settings, SublimeLinter-contrib-scalac provides its own settings. Those marked as “Inline Setting” or “Inline Override” may also be used inline.
Setting | Type | Description | Inline Setting | Inline Override |
---|---|---|---|---|
lint | str \ |
list |
A comma-delimited list of rules to apply. | |
classpath | str \ |
list |
A colon-delimited list of classpath entries. | ✓ |
classpath_filename | str |
Name of file containing colon-delimited classpath. | ✓ | |
target_directory | str |
Where to put class files generated by scalac . |
lint
Valid rules for the lint
option depend on the version of Scala you have
installed. Options with a check in the Default column are enabled by default:
Rule | Description | Scala Version | Default |
---|---|---|---|
check-null | Warn upon selection of nullable reference. | 2.9.1-2.10.4 | |
dead-code | Warn when dead code is identified. | >= 2.9.1 | 2.9.1-2.9.3 |
value-discard | Warn when non-Unit expression results are unused. | >= 2.9.1 | |
numeric-widen | Warn when numerics are widened. | >= 2.9.1 | |
nullary-unit | Warn when nullary methods return Unit. | >= 2.9.1 | ✓ |
inaccessible | Warn about inaccessible types in method signatures. | >= 2.9.1 | ✓ |
nullary-override | Warn when non-nullary def f() overrides nullary def f . |
>= 2.9.1 | ✓ |
adapted-args | Warn if an argument list is modified to match the receiver. | >= 2.10.0 | ✓ |
infer-any | Warn when a type argument is inferred to be Any . |
>= 2.11.0 | ✓ |
unused | Warn when local and private vals, vars, defs, and types are unused. | >= 2.11.0 | |
unused-import | Warn when imports are unused. | >= 2.11.0 | |
missing-interpolator | A string literal appears to be missing an interpolator id. | >= 2.11.2 | ✓ |
doc-detached | A ScalaDoc comment appears to be detached from its element. | >= 2.11.2 | ✓ |
private-shadow | A private field (or class parameter) shadows a superclass field. | >= 2.11.2 | ✓ |
poly-implicit-overload | Parameterized overloaded implicit methods are not visible as view bounds. | >= 2.11.2 | ✓ |
option-implicit | Option.apply used implicit view. | >= 2.11.2 | ✓ |
delayedinit-select | Selecting member of DelayedInit. | >= 2.11.2 | ✓ |
by-name-right-associative | By-name parameter of right associative operator. | >= 2.11.2 | ✓ |
package-object-classes | Class or object defined in package object. | >= 2.11.2 | ✓ |
unsound-match | Pattern match may not be typesafe. | >= 2.11.2 | ✓ |
deprecation | Emit warning and location for usages of deprecated APIs. | >= 2.9.1 | |
unchecked | Enable additional warnings where generated code depends on assumptions. | >= 2.9.1 | |
fatal-warnings | Fail the compilation if there are any warnings. | >= 2.9.1 | |
nowarn | Generate no warnings. | >= 2.9.1 | |
feature | Emit warning and location for usages of features that should be imported explicitly. | >= 2.10.0 |
For example, to enable numeric-widen
and deprecation
, you would add this to
the linter settings:
"scalac": {
"lint": "numeric-widen,deprecation"
}
Or as a list:
"scalac": {
"lint": [
"numeric-widen",
"deprecation"
]
}
To enable feature
and disable doc-detached
but keep the rest of the
settings, you would put this comment on the first or second line of the
file:
// [SublimeLinter scalac-lint:+feature,+-doc-detached]
classpath
If you specify classpath
, the linter plugin will use the given entries as
input to scalac -classpath
.
With an sbt
project, you can get your full classpath by running
sbt 'export fullClasspath'
You may specify classpath
as a string:
"scalac": {
"classpath": "${project}/target/scala-2.11/classes:${project}/lib/lib.jar"
}
Or as a list:
"scalac": {
"classpath": [
"${project}/target/scala-2.11/classes",
"${project}/lib/lib.jar"
]
}
classpath_filename
If you specify classpath_filename
, the linter plugin will search for
a file with that name in the project directory and its parents. If found, it
will use the contents of that file with scalac -classpath
for linting.
If both classpath
and classpath_filename
are specified, their values will
be merged.
The contents of the file must be a colon-delimited list of paths for the JVM to search during compilation. For example:
/path/to/project/classes:/path/to/project/libs/lib.jar
You can also add whitespace between classpath entries for better readability:
:/path/to/project/classes
:/path/to/project/libs/lib.jar
target_directory
This setting tells scalac
where to put generated class files. The plugin will
create the directory if it does not already exist.
For example:
"scalac": {
"target_directory": "${project}/target/scala-2.11/classes"
}
If target_directory
is unset, class files will be put in the same directory as
their source files.
Contributing
If you would like to contribute enhancements or fixes, please do the following:
- Fork the plugin repository.
- Hack on a separate topic branch created from the latest
develop
. - Commit and push the topic branch.
- Make a pull request.
- Be patient. ;-)
Please note that modifications should follow these coding guidelines:
- Indent is 4 spaces.
- Code should pass flake8 and pep257 linters.
- Vertical whitespace helps readability, don’t be afraid to use it.
- Please use descriptive variable names, no abbrevations unless they are very well known.
IMPORTANT!
Also note that this repository uses overcommit as a validation tool. Before making any changes, please install overcommit in your local repository.
Thank you for helping out!