Permalink
Browse files

update closure-linter

  • Loading branch information...
1 parent ea2d235 commit 856690bbc116e5e2f2167886a724bc1412e7df56 @kof committed Mar 23, 2011
View
2 Makefile
@@ -1,5 +1,5 @@
test:
- qunit -c lib/linter.js -t test/test.js --cov false
+ qunit -c ./lib/linter.js -t ./test/test.js --cov false
lint:
linter -f lib -r
View
2 deps/closure-linter/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: closure_linter
-Version: 2.2.6
+Version: 2.2.7
Summary: Closure Linter
Home-page: http://code.google.com/p/closure-linter
Author: The Closure Linter Authors
View
27 deps/closure-linter/closure_linter/checkerbase.py
@@ -20,6 +20,7 @@
'ajp@google.com (Andy Perelson)',
'jacobr@google.com (Jacob Richman)')
+import StringIO
import traceback
import gflags as flags
@@ -134,19 +135,29 @@ def HasErrors(self):
"""
return self.__has_errors
- def Check(self, filename):
+ def Check(self, filename, source=None):
"""Checks the file, printing warnings and errors as they are found.
Args:
filename: The name of the file to check.
+ source: Optional. The contents of the file. Can be either a string or
+ file-like object. If omitted, contents will be read from disk from
+ the given filename.
"""
- try:
- f = open(filename)
- except IOError:
- self.__error_handler.HandleFile(filename, None)
- self.HandleError(errors.FILE_NOT_FOUND, 'File not found', None)
- self.__error_handler.FinishFile()
- return
+
+ if source is None:
+ try:
+ f = open(filename)
+ except IOError:
+ self.__error_handler.HandleFile(filename, None)
+ self.HandleError(errors.FILE_NOT_FOUND, 'File not found', None)
+ self.__error_handler.FinishFile()
+ return
+ else:
+ if type(source) in [str, unicode]:
+ f = StringIO.StringIO(source)
+ else:
+ f = source
try:
if filename.endswith('.html') or filename.endswith('.htm'):
View
12 deps/closure-linter/closure_linter/ecmalintrules.py
@@ -546,7 +546,7 @@ def CheckToken(self, token, state):
while desc_str.endswith('>'):
start_tag_index = desc_str.rfind('<')
if start_tag_index < 0:
- break
+ break
desc_str = desc_str[:start_tag_index].rstrip()
end_position = Position(len(desc_str), 0)
@@ -677,7 +677,8 @@ def CheckToken(self, token, state):
# Languages that don't allow variables to by typed such as
# JavaScript care but languages such as ActionScript or Java
# that allow variables to be typed don't care.
- self.HandleMissingParameterDoc(token, params_iter.next())
+ if not self._limited_doc_checks:
+ self.HandleMissingParameterDoc(token, params_iter.next())
elif op == 'D':
# Deletion
@@ -686,9 +687,10 @@ def CheckToken(self, token, state):
docs_iter.next(), token)
elif op == 'S':
# Substitution
- self._HandleError(errors.WRONG_PARAMETER_DOCUMENTATION,
- 'Parameter mismatch: got "%s", expected "%s"' %
- (params_iter.next(), docs_iter.next()), token)
+ if not self._limited_doc_checks:
+ self._HandleError(errors.WRONG_PARAMETER_DOCUMENTATION,
+ 'Parameter mismatch: got "%s", expected "%s"' %
+ (params_iter.next(), docs_iter.next()), token)
else:
# Equality - just advance the iterators
View
4 deps/closure-linter/closure_linter/full_test.py
@@ -40,7 +40,8 @@
flags.FLAGS.strict = True
flags.FLAGS.custom_jsdoc_tags = ('customtag', 'requires')
flags.FLAGS.closurized_namespaces = ('goog', 'dummy')
-flags.FLAGS.limited_doc_files = ('externs.js', 'dummy.js')
+flags.FLAGS.limited_doc_files = ('externs.js', 'dummy.js',
+ 'limited_doc_checks.js')
# List of files under testdata to test.
# We need to list files explicitly since pyglib can't list directories.
@@ -53,6 +54,7 @@
'indentation.js',
'interface.js',
'jsdoc.js',
+ 'limited_doc_checks.js',
'minimal.js',
'other.js',
'require_all_caps.js',
View
4 deps/closure-linter/closure_linter/javascripttokenizer.py
@@ -201,7 +201,9 @@ class JavaScriptTokenizer(tokenizer.Tokenizer):
Matcher(DOC_INLINE_FLAG, Type.DOC_INLINE_FLAG),
Matcher(DOC_FLAG_LEX_SPACES, Type.DOC_FLAG,
JavaScriptModes.DOC_COMMENT_LEX_SPACES_MODE),
- Matcher(DOC_FLAG, Type.DOC_FLAG),
+
+ # Encountering a doc flag should leave lex spaces mode.
+ Matcher(DOC_FLAG, Type.DOC_FLAG, JavaScriptModes.DOC_COMMENT_MODE),
# Tokenize braces so we can find types.
Matcher(START_BLOCK, Type.DOC_START_BRACE),
View
1 deps/closure-linter/closure_linter/statetracker.py
@@ -65,6 +65,7 @@ class DocFlag(object):
'implements',
'implicitCast',
'interface',
+ 'lends',
'license',
'noalias',
'nocompile',
View
2 deps/closure-linter/setup.py
@@ -20,7 +20,7 @@
from distutils.core import setup
setup(name='closure_linter',
- version='2.2.6',
+ version='2.2.7',
description='Closure Linter',
license='Apache',
author='The Closure Linter Authors',
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "linter",
"description": "Code quality tools collection in one module",
- "version": "0.0.6",
+ "version": "0.0.7",
"author": "Oleg Slobodskoi <oleg008@gmail.com>",
"repository": {
"type": "git",

0 comments on commit 856690b

Please sign in to comment.