[javascriptlint-commit] SF.net SVN: javascriptlint:[328] trunk
Status: Beta
Brought to you by:
matthiasmiller
From: <mat...@us...> - 2013-10-02 23:23:27
|
Revision: 328 http://sourceforge.net/p/javascriptlint/code/328 Author: matthiasmiller Date: 2013-10-02 23:23:24 +0000 (Wed, 02 Oct 2013) Log Message: ----------- pylint: clean up trailing whitespace Modified Paths: -------------- trunk/javascriptlint/conf.py trunk/javascriptlint/lint.py trunk/jsengine/parser/__init__.py trunk/jsengine/structs.py trunk/jsengine/tokenizer/__init__.py trunk/test.py Modified: trunk/javascriptlint/conf.py =================================================================== --- trunk/javascriptlint/conf.py 2013-10-02 23:18:30 UTC (rev 327) +++ trunk/javascriptlint/conf.py 2013-10-02 23:23:24 UTC (rev 328) @@ -163,14 +163,14 @@ def load(self, enabled, parm): if not enabled: raise ConfError('Expected +.') - + self.value = util.JSVersion.fromtype(parm) if not self.value: raise ConfError('Invalid JavaScript version: %s' % parm) class Conf: def __init__(self): - recurse = BooleanSetting(False) + recurse = BooleanSetting(False) self._settings = { 'recurse': recurse, 'output-format': StringSetting('__FILE__(__LINE__): __ERROR__'), Modified: trunk/javascriptlint/lint.py =================================================================== --- trunk/javascriptlint/lint.py 2013-10-02 23:18:30 UTC (rev 327) +++ trunk/javascriptlint/lint.py 2013-10-02 23:23:24 UTC (rev 328) @@ -19,7 +19,7 @@ 'eof', 'comma', 'dot', 'semi', 'colon', 'lc', 'rc', 'lp', 'rb', 'assign', 'relop', 'hook', 'plus', 'minus', 'star', 'divop', 'eqop', 'shop', 'or', 'and', 'bitor', 'bitxor', 'bitand', 'else', 'try' -) +) _globals = frozenset([ 'Array', 'Boolean', 'Math', 'Number', 'String', 'RegExp', 'Script', 'Date', @@ -27,7 +27,7 @@ 'eval', 'NaN', 'Infinity', 'escape', 'unescape', 'uneval', 'decodeURI', 'encodeURI', 'decodeURIComponent', 'encodeURIComponent', - 'Function', 'Object', + 'Function', 'Object', 'Error', 'InternalError', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', 'arguments', 'undefined' Modified: trunk/jsengine/parser/__init__.py =================================================================== --- trunk/jsengine/parser/__init__.py 2013-10-02 23:18:30 UTC (rev 327) +++ trunk/jsengine/parser/__init__.py 2013-10-02 23:23:24 UTC (rev 328) @@ -86,7 +86,7 @@ x.startpos, x.endpos, None, []) items[-1] = items[-1] or comma - # Check for the end. + # Check for the end. if t.peek().tok == tok.RBRACKET: end_comma = comma break @@ -306,7 +306,7 @@ _MULTIPLICATIVE = { tok.MUL: (kind.STAR, op.MUL), tok.DIV: (kind.DIVOP, op.DIV), - tok.MOD: (kind.DIVOP, op.MOD), + tok.MOD: (kind.DIVOP, op.MOD), } def _multiplicative_expression(t): return _binary_expression(t, _MULTIPLICATIVE, _unary_expression) @@ -391,7 +391,7 @@ t.expect(tok.LOGICAL_AND) else: break - + while len(exprs) > 1: right = exprs.pop() left = exprs[-1] @@ -408,7 +408,7 @@ t.expect(tok.LOGICAL_OR) else: break - + while len(exprs) > 1: right = exprs.pop() left = exprs[-1] @@ -467,7 +467,7 @@ kind_, op_ = _ASSIGNS[t.peek().tok] t.advance() right = _assignment_expression(t, allowin) - return ParseNode(kind_, op_, + return ParseNode(kind_, op_, left.startpos, right.endpos, None, [left, right]) else: return left @@ -607,7 +607,7 @@ op.FORIN if condition.kind == kind.IN else None, for_startpos, body.endpos, None, [condition, body]) - + def _continue_statement(t): endtoken = t.expect(tok.CONTINUE) startpos = endtoken.startpos @@ -617,7 +617,7 @@ name = endtoken.atom else: name = None - # TODO: Validate Scope Labels + # TODO: Validate Scope Labels return _auto_semicolon(t, kind.CONTINUE, None, startpos, endtoken.endpos, name, []) def _break_statement(t): @@ -629,19 +629,19 @@ name = endtoken.atom else: name = None - # TODO: Validate Scope Labels + # TODO: Validate Scope Labels return _auto_semicolon(t, kind.BREAK, None, startpos, endtoken.endpos, name, []) def _return_statement(t): endtoken = t.expect(tok.RETURN) startpos = endtoken.startpos - + if t.peek_sameline().tok not in (tok.EOF, tok.EOL, tok.SEMI, tok.RBRACE): expr = _expression(t, True) endtoken = expr else: expr = None - # TODO: Validate Scope Labels + # TODO: Validate Scope Labels return _auto_semicolon(t, kind.RETURN, None, startpos, endtoken.endpos, None, [expr]) @@ -672,7 +672,7 @@ case_kind = kind.DEFAULT else: raise JSSyntaxError(t.peek().startpos, 'invalid_case') - + case_endpos = t.expect(tok.COLON).endpos statements = [] @@ -692,7 +692,7 @@ ParseNode(kind.LC, None, statements_startpos, statements_endpos, None, statements) ])) - + rc_endpos = t.expect(tok.RBRACE).endpos return ParseNode(kind.SWITCH, None, switch_startpos, rc_endpos, None, [expr, @@ -734,7 +734,7 @@ ]) ]) try_endpos = catch_endpos - + if t.peek().tok == tok.FINALLY: t.advance() finally_node = _block_statement(t) @@ -782,7 +782,7 @@ raise JSSyntaxError(x.startpos, 'unexpected_eof') elif x.tok == tok.FUNCTION: return _function_declaration(t, op.CLOSURE) #TODO: warn, since this is not reliable - + elif x.tok not in (tok.LBRACE, tok.FUNCTION): expr = _expression(t, True) if expr.kind == tok.NAME and t.peek().tok == tok.COLON: Modified: trunk/jsengine/structs.py =================================================================== --- trunk/jsengine/structs.py 2013-10-02 23:18:30 UTC (rev 327) +++ trunk/jsengine/structs.py 2013-10-02 23:23:24 UTC (rev 328) @@ -112,7 +112,7 @@ self.endpos = end_pos self.no_semi = no_semi self.end_comma = end_comma - + for i, kid in enumerate(self.kids): if kid: assert isinstance(kid, ParseNode) Modified: trunk/jsengine/tokenizer/__init__.py =================================================================== --- trunk/jsengine/tokenizer/__init__.py 2013-10-02 23:18:30 UTC (rev 327) +++ trunk/jsengine/tokenizer/__init__.py 2013-10-02 23:23:24 UTC (rev 328) @@ -41,7 +41,7 @@ "}": "RBRACE", "(": "LPAREN", ")": "RPAREN", - "[": "LBRACKET", + "[": "LBRACKET", "]": "RBRACKET", ".": "DOT", ";": "SEMI", @@ -58,7 +58,7 @@ "!": "LOGICAL_NOT", "~": "BIT_NOT", "?": "QUESTION", - ":": "COLON", + ":": "COLON", "=": "ASSIGN", "/": "DIV", "!": "LOGICAL_NOT", @@ -159,7 +159,7 @@ def getpos(self, offset=0): return self._nodepositions.from_offset(self._pos+offset) - + def watch_reads(self): self._watched_pos = self._pos @@ -316,7 +316,7 @@ def _next(self, parse_regexp=False): stream = self._stream - + if stream.eof(): return Token(tok.EOF) @@ -331,10 +331,10 @@ elif stream.readif(1, _WHITESPACE): pass else: - break + break if linebreak: return Token(tok.EOL) - else: + else: return Token(tok.SPACE) # COMMENTS Modified: trunk/test.py =================================================================== --- trunk/test.py 2013-10-02 23:18:30 UTC (rev 327) +++ trunk/test.py 2013-10-02 23:23:24 UTC (rev 328) @@ -96,7 +96,7 @@ class _CustomLintReporter(TextReporter): line_format = '{path}({line}): [{msg_id}({symbol}){obj}] {msg}' def __init__(self): - TextReporter.__init__(self) + TextReporter.__init__(self) self.msg_count = 0 def write_message(self, msg): @@ -129,7 +129,6 @@ 'C0103', # Invalid name "%s" (should match %s) 'C0202', # Class method should have "cls" as first argument 'C0301', # Line too long (%s/%s) - 'C0303', # Trailing whitespace 'C0321', # More than one statement on a single line 'C0323', # Operator not followed by a space 'C0324', # Comma not followed by a space This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |