Skip to content

Commit 58a9895

Browse files
Auz9groteworld
authored andcommitted
Re-submit fix #33 version 2
As ian4hu pointed out in [#33](https://github.com/SublimeLinter/SublimeLinter-html-tidy/pull/SublimeLinter#33), Linter.which() called from within the HtmlTidy class definition resulted in an early invocation situation in which a fail test resulted for Linter's settings, _paths_ in particular, prior to any setting being cached. Changes to fix this.
1 parent 8ffd06f commit 58a9895

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

linter.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,18 @@ class HtmlTidy(Linter):
1818
"""Provides an interface to tidy."""
1919

2020
syntax = 'html'
21-
if Linter.which('tidy5'):
22-
cmd = 'tidy5 -errors -quiet -utf8'
23-
else:
24-
cmd = 'tidy -errors -quiet -utf8'
21+
executable = 'tidy'
22+
version_args = '--version'
23+
version_re = r'(?P<version>\d+\.\d+\.\d+)'
24+
version_requirement = '>= 4.9'
2525
regex = r'^line (?P<line>\d+) column (?P<col>\d+) - (?:(?P<error>Error)|(?P<warning>Warning)): (?P<message>.+)'
2626
error_stream = util.STREAM_STDERR
27+
28+
def cmd(self):
29+
"""Return a tuple with the command line to execute."""
30+
command = [self.executable_path, '-errors', '-quiet', '-utf8']
31+
if Linter.which('tidy5'):
32+
command[0] = Linter.which('tidy5')
33+
else:
34+
command[0] = Linter.which('tidy')
35+
return command

0 commit comments

Comments
 (0)