-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit establishes the baseline for an ERB linter that can be used in Sublime Text 3. It extends Sublime Linter
- Loading branch information
0 parents
commit ad70593
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
SublimeLinter-contrib-erblint | ||
================================ | ||
|
||
[![Build Status](https://travis-ci.org/TomasBarry/SublimeLinter-contrib-erblint.svg?branch=master)](https://travis-ci.org/TomasBarry/SublimeLinter-contrib-erblint) | ||
|
||
This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [erblint](https://github.com/Shopify/erb-lint). It will be used with files that have the “erb” 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 `erblint` is installed on your system. | ||
|
||
1. Install [Ruby](http://ruby-lang.org). | ||
|
||
1. Install `erblint` by typing the following in a terminal: | ||
``` | ||
[sudo] gem install erblint | ||
``` | ||
|
||
1. If you are using `rvm` or `rbenv`, ensure that they are loaded in your shell’s correct startup file. See [here](http://sublimelinter.com/en/latest/troubleshooting.html#adjusting-shell-startup-files) for more information. | ||
|
||
In order for `erblint` 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from SublimeLinter.lint import util, Linter | ||
|
||
|
||
class ERBLint(Linter): | ||
"""A linter for Embedded Ruby files (.erb) | ||
This class extends SublimeLinter.lint.Linter. It defines the most basic set | ||
of configs for running the 'out of the box' version of `erblint` | ||
An example output of `erblint ~/path/to/file.erb is: | ||
``` | ||
.erb-lint.yml not found: using default config | ||
Linting 1 files with 12 linters... | ||
... | ||
Tag `input` is self-closing, it must end with `/>`. | ||
In file: path/to/file.html.erb:123 | ||
... | ||
12 error(s) were found in ERB files | ||
``` | ||
The regex defined below matches the error output from `erblint`. In order to | ||
ignore the extra warning (when not passing a config file to `erblint`) we | ||
set `error_stream` to `util.STREAM_STDOUT`. | ||
""" | ||
cmd = 'erblint ${args} ${temp_file}' | ||
regex = ( | ||
r'^(?P<message>.*)\n' | ||
r'In file: .*:(?P<line>[0-9]+)' | ||
) | ||
multiline = True | ||
tempfile_suffix = 'erb' | ||
error_stream = util.STREAM_STDOUT | ||
defaults = { | ||
'selector': 'text.html.ruby' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"install": "messages/install.txt" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SublimeLinter-contrib-erblint | ||
------------------------------- | ||
This linter plugin for SublimeLinter provides an interface to erblint. | ||
|
||
For more information, please see: | ||
https://github.com/TomasBarry/SublimeLinter-contrib-erblint |