Skip to content

Commit 53e8ca8

Browse files
Anderson, ChaseAnderson, Chase
authored andcommitted
initial commit
0 parents  commit 53e8ca8

8 files changed

Lines changed: 168 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

.sublimelinterrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"@python": 3,
3+
"linters": {
4+
"flake8": {
5+
"max-line-length": 120
6+
},
7+
"pep257": {
8+
"ignore": ["D202"]
9+
},
10+
"pep8": {
11+
"max-line-length": 120
12+
}
13+
}
14+
}

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: python
2+
python:
3+
- "3.3"
4+
# command to install dependencies
5+
install:
6+
- pip install flake8
7+
- pip install pep257
8+
# command to run tests
9+
script:
10+
- flake8 *.py --max-line-length=120
11+
- pep257 . --ignore=D202

LICENSE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Permission is hereby granted, free of charge, to any person obtaining a copy
2+
of this software and associated documentation files (the "Software"), to deal
3+
in the Software without restriction, including without limitation the rights
4+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5+
copies of the Software, and to permit persons to whom the Software is
6+
furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in
9+
all copies or substantial portions of the Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17+
THE SOFTWARE.

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
SublimeLinter-SummitLua
2+
================================
3+
4+
This linter plugin for [SublimeLinter][docs] provides an interface to [Corvisa Cloud, LLC's SummitEditor](https://github.com/corvisacloud/SummitEditor) through `luacheck`. It will be used with files that have the “__Lua (Summit)__” syntax.
5+
6+
## Installation
7+
SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions [here][installation]. SummitEditor must also be installed. If it is not installed, follow the [instructions](https://github.com/corvisacloud/SummitEditor/blob/master/README.md).
8+
9+
### Linter installation
10+
Before using this plugin, you must ensure that `luacheck` is installed on your system. To install `luacheck`, follow the [instructions](https://github.com/mpeterv/luacheck/blob/master/README.md).
11+
12+
**Note:** `luacheck` requires `lua` to be installed.
13+
14+
### Linter configuration
15+
In order for `luacheck` 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”](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable) through “Validating your PATH” in the documentation.
16+
17+
Once you have installed and configured `luacheck`, you can proceed to install the SublimeLinter-SummitLua plugin if it is not yet installed.
18+
19+
### Plugin installation
20+
Please use [Package Control][pc] 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.
21+
22+
To install via Package Control, do the following:
23+
24+
1. Within Sublime Text, bring up the [Command Palette][cmd] and type `install`. Among the commands you should see `Package 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.
25+
26+
1. When the plugin list appears, type `SummitLua`. Among the entries you should see `SublimeLinter-SummitLua`. If that entry is not highlighted, use the keyboard or mouse to select it.
27+
28+
## Settings
29+
For general information on how SublimeLinter works with settings, please see [Settings][settings]. For information on generic linter settings, please see [Linter Settings][linter-settings].
30+
31+
In addition to the standard SublimeLinter settings, SublimeLinter-SummitLua provides its own settings adapted from the [`luacheck` settings](https://github.com/mpeterv/luacheck#command-line-interface). Those marked as “Default Setting" have their own setting in SublimeLinter's user settings for `summitlua`. Those not marked as "Default Setting" go in the `args` list in SublimeLinter's user settings for `summitlua`.
32+
33+
|Setting|Description|Default Setting|
34+
|:------|:----------|:-------------:|
35+
|`-g, --no-global`|Do not check for accessing global variables.| |
36+
|`-r, --no-redefined`|Do not check for redefined variables.| |
37+
|`-u, --no-unused`|Do not check for unused variables.| |
38+
|`-a, --no-unused-args`|Do not check for unused arguments and loop variables. ||
39+
|`-v, --no-unused-values`|Do not check for unused values.||
40+
|`globals [<global>]`|Defined globals.|&#10003;|
41+
|`-c, --compat`|Adjust globals for Lua 5.1/5.2 compatibility.||
42+
|`-e, --ignore-env`|Do not be _ENV-aware.||
43+
|`ignore [<var>]`|Do not report warnings related to these variables|&#10003;|
44+
|`only [<var>]`|Only report warnings related to these variables|&#10003;|
45+
|`limit <limit>`|Exit with 0 if there are \<limit\> or less warnings.|&#10003;|
46+
|`-q, --quiet`|Suppress output for files without warnings. `-qq`: Only print total number of warnings and errors. `-qqq`: Suppress output completely. ||
47+
48+
Settings marked as "Default Setting" may also be used inline as per [SublimeLinter's documentation][inline-settings]. Since, by default, `channel` and `require` are pre-defined as `globals`, using the `globals`setting inline requires you to include `channel` and `require` again in addition to any other settings. For example: `-- [SublimeLinter summitlua-globals:channel,require,foo]` will maintain default behavior while adding `foo` as a global. This follows for any default settings saved in SublimeLinter's user settings as well. For example, if `"ignore": "foo"` is in your user settings, using `ignore` to ignore `bar` inline (while continuing to ignore `foo`) would require the following: `-- [SublimeLinter summitlua-ignore:foo,bar]`.
49+
50+
[docs]: http://sublimelinter.readthedocs.org
51+
[installation]: http://sublimelinter.readthedocs.org/en/latest/installation.html
52+
[locating-executables]: http://sublimelinter.readthedocs.org/en/latest/usage.html#how-linter-executables-are-located
53+
[pc]: https://sublime.wbond.net/installation
54+
[cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html
55+
[settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html
56+
[linter-settings]: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html
57+
[inline-settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html#inline-settings

linter.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# linter.py
3+
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
4+
#
5+
#
6+
# Copyright (c) 2014 CorvisaCloud, LLC
7+
#
8+
# License: MIT
9+
#
10+
11+
"""This module exports the LuaSummit plugin class."""
12+
13+
from SublimeLinter.lint import Linter, util
14+
15+
16+
class SummitLua(Linter):
17+
"""Provides an interface to luacheck for the SummitEditor syntax."""
18+
syntax = 'summit'
19+
tempfile_suffix = 'lua'
20+
defaults = {
21+
'--ignore:,': '',
22+
'--only:,': '',
23+
'--limit=': None,
24+
'--globals: ': 'channel,require',
25+
}
26+
comment_re = r'\s*-[-*]'
27+
inline_settings = ('ignore', 'limit', 'only', 'globals')
28+
cmd = 'luacheck @ *'
29+
regex = r'^(?P<filename>[^:]+):(?P<line>\d+):(?P<col>\d+): (?P<message>.*)$'
30+
def build_args(self, settings):
31+
"""Return args, transforming --ignore, --only, and --globals args into a format luacheck understands."""
32+
args = super().build_args(settings)
33+
print(args)
34+
try:
35+
index = args.index('--ignore')
36+
# Split the comma-separated arg after --ignore into separate elements
37+
vars = args[index + 1].split(',')
38+
args[index + 1:index + 2] = vars
39+
except ValueError:
40+
pass
41+
42+
try:
43+
index = args.index('--only')
44+
vars = args[index + 1].split(',')
45+
args[index + 1:index + 2] = vars
46+
except ValueError:
47+
pass
48+
49+
try:
50+
index = args.index('--globals')
51+
vars = args[index + 1].split(',')
52+
args[index + 1:index + 2] = vars
53+
except ValueError:
54+
pass
55+
return args

messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"install": "messages/install.txt"
3+
}

messages/install.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SublimeLinter-SummitLua
2+
-------------------------------
3+
This linter plugin for SublimeLinter provides an interface to luacheck and SummitEditor.
4+
5+
** IMPORTANT! **
6+
7+
Before this plugin will activate, you *must*
8+
follow the installation instructions here:
9+
10+
https://github.com/corvisacloud/SublimeLinter-SummitLua

0 commit comments

Comments
 (0)