Flet / SublimeLinter-contrib-semistandard

MIT License
13 stars 6 forks source link

IndexError: list index out of range #1

Closed bnolan closed 9 years ago

bnolan commented 9 years ago

I think this is an error with contrib-standard as well - semistandard outputs lint errors in all files in the current directory (not just the current one), so the linter shows errrors for all files in the current file. And if there are errors at a higher line number than the number of lines in this file, well then... KABOOM!

I'm moving an entire project to semistandard, so if I coulduse this linter on multiple files (without moving each file into /tmp) that would be great.

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "/Users/ben/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/commands.py", line 96, in run
    SublimeLinter.shared_plugin().lint(self.view.id())
  File "/Users/ben/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/sublimelinter.py", line 123, in lint
    Linter.lint_view(view, filename, code, hit_time, callback)
  File "/Users/ben/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 917, in lint_view
    linter.lint(hit_time)
  File "/Users/ben/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/node_linter.py", line 78, in lint
    super(NodeLinter, self).lint(hit_time)
  File "/Users/ben/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 1356, in lint
    start, end = self.highlight.full_line(line)
  File "/Users/ben/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/highlight.py", line 202, in full_line
    start = self.newlines[line] + char_offset
IndexError: list index out of range
Flet commented 9 years ago

Hmm I will check it out tonight.

bnolan commented 9 years ago

Fixed:

class Semistandard(NodeLinter):

    """Provides an interface to semistandard."""

    syntax = ('javascript', 'html', 'javascriptnext', 'javascript 6to5')
    cmd = ('semistandard', '-')
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 2.5.0'
    regex = r'^\s.+:(?P<line>\d+):(?P<col>\d+):(?P<message>.+)'
    selectors = {
        'html': 'source.js.embedded.html'
    }

Tells it to use stdin. :)

Flet commented 9 years ago

Cool also I think it needs --stdin passed too

Flet commented 9 years ago

This should be fixed with version 1.0.1, which should be on package control in 30 minutes or so. https://github.com/Flet/SublimeLinter-contrib-semistandard/commit/eca74dd75b65584b4a5b0b8db04c1142635994ba

Heads up: you'll need to install semistandard 4.0.3 which was just released.