Created
May 12, 2016 20:01
-
-
Save jbgutierrez/ede1b19b594bb200326b1c203fc5610e to your computer and use it in GitHub Desktop.
scss-lint with SublimeLinter in ST2
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
import re | |
from base_linter import BaseLinter | |
CONFIG = { | |
'language': 'SCSS', | |
'executable': 'scss-lint.sh', | |
'lint_args': '{filename}' | |
} | |
class Linter(BaseLinter): | |
def parse_errors(self, view, errors, lines, errorUnderlines, violationUnderlines, warningUnderlines, errorMessages, violationMessages, warningMessages): | |
for line in errors.splitlines(): | |
match = re.match(r'^.+:(?P<line>\d+)\s\[(?P<type>W)\]\s(?P<error>.+)', line) | |
if match: | |
error_type, error, line = match.group('type'), match.group('error'), match.group('line') | |
line = int(line) | |
error = '[{0}] {1}'.format(error_type[0].upper(), error) | |
if error_type == 'W': | |
messages = warningMessages | |
underlines = warningUnderlines | |
else: | |
messages = errorMessages | |
underlines = errorUnderlines | |
self.add_message(line, lines, error, messages) | |
self.underline_range(view, line, 0, underlines) |
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
#!/usr/bin/env bash | |
echo $(scss-lint -c ~/.scss-lint.yml $*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment