mirror of
https://github.com/Reuh/SublimeLinter-contrib-cancheck.git
synced 2025-10-27 12:19:30 +00:00
Initial commit
This commit is contained in:
commit
35508499f5
8 changed files with 147 additions and 0 deletions
41
.gitignore
vendored
Executable file
41
.gitignore
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Node installed packages #
|
||||
###########################
|
||||
node_modules/*
|
||||
7
.travis.yml
Executable file
7
.travis.yml
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
language: python
|
||||
python:
|
||||
- "3.6"
|
||||
install:
|
||||
- pip install flake8
|
||||
script:
|
||||
- flake8 . --max-line-length=120
|
||||
32
HOWTO.md
Executable file
32
HOWTO.md
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
Creating a Linter Plugin
|
||||
========================
|
||||
|
||||
- Fork this repo to bootstrap your new linter.
|
||||
- Clone it into Packages.
|
||||
- Change a linter.py.
|
||||
- Update the README and replace `__linter__` placeholders.
|
||||
- Update messages/install.txt and replace `__linter__` placeholders.
|
||||
- Open a PR in our [package_control repo](https://github.com/SublimeLinter/package_control_channel) to make it available to others.
|
||||
|
||||
Additional documentation can be found at [sublimelinter.com](http://sublimelinter.com).
|
||||
|
||||
|
||||
Updating class attributes
|
||||
--------------------------
|
||||
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:
|
||||
|
||||
- Change the default `'selector'` to include the scopes you want the linter to lint.
|
||||
|
||||
- Change the `cmd` attribute to include the executable and arguments you want to include on *every* run. Usually this should be a tuple like `('linter', '-fooarg', '-etc', '-')`. You can also make `cmd` a method (or callable in python speak) which returns such a tuple.
|
||||
|
||||
- Change the `regex` attribute to correctly capture the error output from the linter.
|
||||
|
||||
- Change the `multiline` attribute to `True` if the regex parses multiline error messages.
|
||||
|
||||
Other, optional, attributes include:
|
||||
|
||||
- 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.
|
||||
|
||||
- If the linter outputs errors only on `stderr` or `stdout`, set `error_stream` to `util.STREAM_STDERR` or `util.STREAM_STDOUT` respectively.
|
||||
|
||||
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).
|
||||
17
LICENSE
Executable file
17
LICENSE
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
19
README.md
Executable file
19
README.md
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
SublimeLinter-contrib-candran
|
||||
================================
|
||||
|
||||
[](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-cancheck)
|
||||
|
||||
This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [cancheck](https://github.com/Reuh/candran). It will be used with files that have the “Candran” syntax.
|
||||
|
||||
## Installation
|
||||
SublimeLinter must be installed in order to use this plugin.
|
||||
|
||||
Please use [Package Control](https://packagecontrol.io) to install the linter plugin.
|
||||
|
||||
Before installing this plugin, you must ensure that `cancheck` (which is included with [Candran](https://github.com/Reuh/candran), and requires [luacheck](https://github.com/luarocks/luacheck) to be installed) is installed on your system.
|
||||
|
||||
In order for `cancheck` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover [troubleshooting PATH configuration](http://sublimelinter.readthedocs.io/en/latest/troubleshooting.html#finding-a-linter-executable).
|
||||
|
||||
## Settings
|
||||
- SublimeLinter settings: http://sublimelinter.readthedocs.org/en/latest/settings.html
|
||||
- Linter settings: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html
|
||||
22
linter.py
Executable file
22
linter.py
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
# Taken from https://github.com/SublimeLinter/SublimeLinter-luacheck
|
||||
|
||||
from SublimeLinter.lint import Linter
|
||||
|
||||
|
||||
class Luacheck(Linter):
|
||||
cmd = 'cancheck - --formatter=plain --codes --ranges --filename ${file}'
|
||||
regex = (
|
||||
r'^.+:(?P<line>\d+):(?P<col>\d+)\-(?P<col_end>\d+): '
|
||||
r'\((?:(?P<error>E\d+)|(?P<warning>W\d+))\) '
|
||||
r'(?P<message>.+)'
|
||||
)
|
||||
defaults = {
|
||||
'selector': 'source.candran'
|
||||
}
|
||||
|
||||
def split_match(self, match):
|
||||
"""Patch regex matches to highlight token correctly."""
|
||||
match, line, col, error, warning, msg, _ = super().split_match(match)
|
||||
col_end = int(match.group(3))
|
||||
token_len = col_end - col
|
||||
return match, line, col, error, warning, msg, "." * token_len
|
||||
3
messages.json
Executable file
3
messages.json
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"install": "messages/install.txt"
|
||||
}
|
||||
6
messages/install.txt
Executable file
6
messages/install.txt
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
SublimeLinter-contrib-candran
|
||||
-------------------------------
|
||||
This linter plugin for SublimeLinter provides an interface to cancheck.
|
||||
|
||||
For more information, please see:
|
||||
https://github.com/Reuh/SublimeLinter-contrib-candran
|
||||
Loading…
Add table
Add a link
Reference in a new issue