Skip to content

Commit 27c337b

Browse files
committed
clean up basic attributes
1 parent 1ff00d4 commit 27c337b

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

HOWTO.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ Updating class attributes
1515
--------------------------
1616
Template linter plugins are created with almost all of the Linter class attributes filled in with the default values. To make your new linter plugin functional, at the very least you need to do the following:
1717

18-
- Change the `syntax` attribute to indicate the syntax (or syntaxes) that the linter lints.
18+
- Change the default `'selector'` to include the scopes you want the linter to lint.
1919

2020
- Change the `cmd` attribute to include the executable and arguments you want to include on every run. Or if you are going to implement a `cmd <cmd-method>` method, set the attribute to `None` and set the `executable` attribute to the name of the linter executable.
2121

2222
- Change the `regex` attribute to correctly capture the error output from the linter.
2323

2424
- Change the `multiline` attribute to `True` if the regex parses multiline error messages.
2525

26+
Other, optional, attributes include:
27+
2628
- Determine the minimum/maximum versions of the linter executable that will work with your plugin and change the `version_args`, `version_re` and `version_requirement` attributes accordingly.
2729

2830
- If the linter executable does not accept input via `stdin`, set the `tempfile_suffix` attribute to the filename suffix of the temp files that will be created.
2931

30-
These are the minimum requirements to make a linter plugin functional. However, depending on the features of the linter executable, you may need to configure other class attributes.
31-
3232
- If the linter outputs errors only on `stderr` or `stdout`, set `error_stream` to `util.STREAM_STDERR` or `util.STREAM_STDOUT` respectively.
3333

3434
- If you wish to support embedded syntaxes, set the `selectors` attribute accordingly.
3535

3636
- If the linter subclasses from `PythonLinter`, remove the `module` attribute if you do not plan to use the linter’s python API. If you do, you will need to implement the `check` method.
3737

38-
You should remove attributes that you do not change, as their values will be provided by the superclass.
38+
You should remove attributes that you do not change, as their values will be provided by the superclass. More information can be found in the [docs](https://github.com/SublimeLinter/SublimeLinter/blob/master/docs/linter_attributes.rst).

linter.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
from SublimeLinter.lint import __superclass__, util
1+
from SublimeLinter.lint import Linter # or NodeLinter, PythonLinter, ComposerLinter, RubyLinter
22

33

4-
class __class__(__superclass__):
5-
syntax = ''
4+
class __class__(Linter):
65
cmd = '__cmd__'
7-
executable = None
8-
version_args = '--version'
9-
version_re = r'(?P<version>\d+\.\d+\.\d+)'
10-
version_requirement = '>= 1.0'
116
regex = r''
127
multiline = False
13-
line_col_base = (1, 1)
14-
tempfile_suffix = None
15-
error_stream = util.STREAM_BOTH
16-
selectors = {}
17-
word_re = None
18-
defaults = {}
8+
defaults = {
9+
'selector': 'source.python'
10+
}

0 commit comments

Comments
 (0)