/SublimeLinter.sublime-settings Secret
Last active
December 21, 2015 04:59
Adding ruby-tailor support to SublimeLinter Assumes you have installed tailor with rbenv ~/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/sublimelinter/modules/ruby-tailor.py
~/Library/Application Support/Sublime Text 3/Packages/User/SublimeLinter.sublime-settings
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
#------------------------------------------------------------------------------# | |
# File: | |
# app.rb | |
# | |
# File Set: | |
# default | |
# | |
# Problems: | |
# 1. | |
# * position: <EOF> | |
# * property: trailing_newlines | |
# * message: File has 0 trailing newlines, but should have 1. | |
# 2. | |
# * position: 6:207 | |
# * property: max_line_length | |
# * message: Line is 207 chars long, but should be 80. | |
# 3. | |
# * position: 12:260 | |
# * property: max_line_length | |
# * message: Line is 260 chars long, but should be 80. | |
# | |
#------------------------------------------------------------------------------# | |
#------------------------------------------------------------------------------# | |
# Tailor Summary | | |
#------------------------------------------------------------------------------# | |
# File | Probs | | |
#------------------------------------------------------------------------------# | |
# app.rb | 3 | | |
#------------------------------------------------------------------------------# | |
# Error | 3 | | |
#------------------------------------------------------------------------------# | |
# TOTAL | 3 | | |
#------------------------------------------------------------------------------# |
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': 'ruby-tailor', | |
'executable': '/usr/local/var/rbenv/shims/tailor', | |
'lint_args': '{filename}' | |
} | |
class Linter(BaseLinter): | |
def parse_errors(self, view, errors, lines, errorUnderlines, violationUnderlines, warningUnderlines, errorMessages, violationMessages, warningMessages): | |
# print('whee') | |
output = errors.splitlines() | |
for index, line in enumerate(output): | |
# print(line) | |
line_and_column_match = re.match(r'^.+position: (?P<line>\d+):(?P<column>\d+)', line) | |
if line_and_column_match: | |
# get the message text that's 2 lines ahead | |
message_match = re.match(r'^.+message: (?P<error>.+)', output[index+2]) | |
line = int(line_and_column_match.group('line')) | |
column = int(line_and_column_match.group('column')) | |
error = message_match.group('error') | |
# print('matched line:') | |
# print(line) | |
# print('matched column:') | |
# print(column) | |
# print('message:') | |
# print(error) | |
if line == '<EOF>': | |
# dunno what to do for EOF | |
line = '1' | |
self.add_message(line, lines, error, errorMessages) | |
self.underline_range(view, line, column, errorUnderlines) | |
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
Show hidden characters
{ | |
// "sublimelinter": "load-save", | |
"sublimelinter_syntax_map": | |
{ | |
"Python Django": "python", | |
"Ruby on Rails": "ruby", | |
"C++": "c", | |
"Ruby": "ruby-tailor" | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment