Skip to content

Commit

Permalink
Merge pull request #11 from borela-forks/use-selector
Browse files Browse the repository at this point in the history
Use selector to detect syntax
  • Loading branch information
thedaviddias committed Sep 27, 2018
2 parents 11c317a + 91d4ee2 commit 89cc4d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ install:
# command to run tests
script:
- flake8 . --max-line-length=120
- pep257 . --ignore=D202
- pep257 . --ignore=D202 --ignore=D211
21 changes: 13 additions & 8 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class Htmlhint(NodeLinter):

"""Provides an interface to htmlhint."""

syntax = 'html'
defaults = {
'selector': 'text.html'
}
cmd = ('htmlhint', '--format', 'json', '--nocolor', 'stdin')
version_args = '--version'
version_re = r'(?P<version>\d+\.\d+\.\d+)'
Expand All @@ -34,7 +36,6 @@ def find_errors(self, output):
Calls parse_message for each error found.
"""

output_json = sublime.decode_value(output)

# persist.debug('output_json:"{}", file: "{}"'.format(output_json, self.filename))
Expand All @@ -44,11 +45,7 @@ def find_errors(self, output):
yield self.parse_message(message)

def parse_message(self, message):
"""
Parse message object into standard elements of an error and return them.
"""

"""Parse message object into standard elements of an error and return them."""
error_message = message['message']
line = message['line'] - 1
col = message['col']
Expand All @@ -66,6 +63,14 @@ def parse_message(self, message):
# ignore info messages by setting message to None
message = None

persist.debug('message -- msg:"{}", line:{}, col:{}, error: {}, warning: {}, message_obj:{}'.format(error_message, line, col, error, warning, message))
message = 'message -- msg:"{}", line:{}, col:{}, error: {}, warning: {}, message_obj:{}'
persist.debug(message.format(
error_message,
line,
col,
error,
warning,
message,
))

return message, line, col, error, warning, error_message, None

0 comments on commit 89cc4d2

Please sign in to comment.