Permalink
Browse files

coffeescript linter based on https://github.com/clutchski/coffeelint

  • Loading branch information...
1 parent 2046564 commit 2b5e17c091a334e48b976f877ed7f2a1e8c6d60e @sjz sjz committed Mar 15, 2012
Showing with 31 additions and 0 deletions.
  1. +31 −0 sublimelinter/modules/coffeelint.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# coffeelint.py - sublimelint package for checking coffee files
+# based on coffeescript.py, inspired by https://github.com/clutchski/coffeelint
+
+import re
+import os
+
+from base_linter import BaseLinter
+
+CONFIG = {
+ 'language': 'coffeescript',
+ 'executable': 'coffeelint.cmd' if os.name == 'nt' else 'coffeelint',
+ 'lint_args': '--stdin'
+}
+
+
+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+) : (?P<type>[a-z]+) : (?P<err>.+)',
+ line)
+ if match:
+ line, err_text = int(match.group('line')), match.group('err')
+ err_type = match.group('type')
+
+ grp = errorMessages if err_type == 'error' else warningMessages
+
+ self.add_message(line, lines, err_text, grp)

0 comments on commit 2b5e17c

Please sign in to comment.