mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-15 11:13:50 +00:00
Make LintChecker().lint_text('<code>') possible.
Made LintChecker()'s "view" and lint_text's "filename" arguments optional. Filename will default to <stdin> like Python does when you pipe to it. Also return found errors from lint_text as a convenience.
This commit is contained in:
1 parent
e25394a322
commit
24cce3ca8a
1 file changed
+4
-2
@@ -266,7 +266,7 @@ class LintChecker(object):
|
||||
TEXT_ERROR_SINGLE_FILE_TEMPLATE = Template(u'$lineNum: $message.\n+$line\n')
|
||||
TEXT_ERROR_MULTI_FILE_TEMPLATE = Template(u'$filename:$lineNum: $message.\n+$line\n')
|
||||
|
||||
def __init__(self, view, basedir='', var_declarations=VAR_DECLARATIONS_SINGLE, verbose=False):
|
||||
def __init__(self, view=None, basedir='', var_declarations=VAR_DECLARATIONS_SINGLE, verbose=False):
|
||||
self.view = view
|
||||
self.basedir = unicode(basedir, 'utf-8')
|
||||
self.errors = []
|
||||
@@ -747,7 +747,7 @@ class LintChecker(object):
|
||||
print u'EOF\n'
|
||||
pass
|
||||
|
||||
def lint_text(self, text, filename):
|
||||
def lint_text(self, text, filename="<stdin>"):
|
||||
self.filename = filename
|
||||
self.filesToCheck = []
|
||||
|
||||
@@ -759,6 +759,8 @@ class LintChecker(object):
|
||||
print u'EOF\n'
|
||||
pass
|
||||
|
||||
return self.errors
|
||||
|
||||
def count_files_checked(self):
|
||||
return len(self.filesToCheck)
|
||||
|
||||
|
||||
Reference in new issue
Block a user