Thread: [javascriptlint-commit] SF.net SVN: javascriptlint:[202] trunk/pyjsl/warnings.py
Status: Beta
Brought to you by:
matthiasmiller
From: <mat...@us...> - 2008-08-15 14:47:31
|
Revision: 202 http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=202&view=rev Author: matthiasmiller Date: 2008-08-15 14:47:29 +0000 (Fri, 15 Aug 2008) Log Message: ----------- comparison_type_conv: fix warning Modified Paths: -------------- trunk/pyjsl/warnings.py Modified: trunk/pyjsl/warnings.py =================================================================== --- trunk/pyjsl/warnings.py 2008-05-14 16:04:10 UTC (rev 201) +++ trunk/pyjsl/warnings.py 2008-08-15 14:47:29 UTC (rev 202) @@ -176,12 +176,11 @@ def comparison_type_conv(node): for kid in node.kids: if kid.kind == tok.PRIMARY and kid.opcode in (op.NULL, op.TRUE, op.FALSE): - continue + raise LintWarning, kid if kid.kind == tok.NUMBER and not kid.dval: - continue + raise LintWarning, kid if kid.kind == tok.STRING and not kid.atom: - continue - raise LintWarning, kid + raise LintWarning, kid @lookfor(tok.DEFAULT) def default_not_at_end(node): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2008-08-15 14:55:24
|
Revision: 203 http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=203&view=rev Author: matthiasmiller Date: 2008-08-15 14:55:20 +0000 (Fri, 15 Aug 2008) Log Message: ----------- var_hides_arg: implement warning Modified Paths: -------------- trunk/pyjsl/warnings.py Modified: trunk/pyjsl/warnings.py =================================================================== --- trunk/pyjsl/warnings.py 2008-08-15 14:47:29 UTC (rev 202) +++ trunk/pyjsl/warnings.py 2008-08-15 14:55:20 UTC (rev 203) @@ -450,10 +450,17 @@ def legacy_cc_not_understood(node): pass -@lookfor() +@lookfor(tok.NAME) def var_hides_arg(node): - pass + if node.parent.kind != tok.VAR: + return + parent = node.parent + while parent: + if parent.kind == tok.FUNCTION and node.atom in parent.fn_args: + raise LintWarning, node + parent = parent.parent + @lookfor() def duplicate_formal(node): pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2008-08-15 15:14:08
|
Revision: 205 http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=205&view=rev Author: matthiasmiller Date: 2008-08-15 15:14:03 +0000 (Fri, 15 Aug 2008) Log Message: ----------- revert r203; var_hides_arg is handled elsewhere Modified Paths: -------------- trunk/pyjsl/warnings.py Modified: trunk/pyjsl/warnings.py =================================================================== --- trunk/pyjsl/warnings.py 2008-08-15 15:11:11 UTC (rev 204) +++ trunk/pyjsl/warnings.py 2008-08-15 15:14:03 UTC (rev 205) @@ -450,17 +450,10 @@ def legacy_cc_not_understood(node): pass -@lookfor(tok.NAME) +@lookfor() def var_hides_arg(node): - if node.parent.kind != tok.VAR: - return + pass - parent = node.parent - while parent: - if parent.kind == tok.FUNCTION and node.atom in parent.fn_args: - raise LintWarning, node - parent = parent.parent - @lookfor() def duplicate_formal(node): pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2008-08-15 19:53:51
|
Revision: 206 http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=206&view=rev Author: matthiasmiller Date: 2008-08-15 19:53:49 +0000 (Fri, 15 Aug 2008) Log Message: ----------- fix duplicate meaningless_block warning Modified Paths: -------------- trunk/pyjsl/warnings.py Modified: trunk/pyjsl/warnings.py =================================================================== --- trunk/pyjsl/warnings.py 2008-08-15 15:14:03 UTC (rev 205) +++ trunk/pyjsl/warnings.py 2008-08-15 19:53:49 UTC (rev 206) @@ -31,7 +31,6 @@ 'with_statement': 'with statement hides undeclared variables; use temporary variable instead', 'useless_comparison': 'useless comparison; comparing identical expressions', 'use_of_label': 'use of label', - 'meaningless_block': 'meaningless block; curly braces have no impact', 'misplaced_regex': 'regular expressions should be preceded by a left parenthesis, assignment, colon, or comma', 'assign_to_function_call': 'assignment to a function call', 'ambiguous_else_stmt': 'the else statement could be matched with one of multiple if statements (use curly braces to indicate intent', @@ -223,11 +222,6 @@ def use_of_label(node): raise LintWarning, node -@lookfor(tok.LC) -def meaningless_block(node): - if node.parent and node.parent.kind == tok.LC: - raise LintWarning, node - @lookfor((tok.OBJECT, op.REGEXP)) def misplaced_regex(node): if node.parent.kind == tok.NAME and node.parent.opcode == op.SETNAME: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2008-09-01 15:57:39
|
Revision: 237 http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=237&view=rev Author: matthiasmiller Date: 2008-09-01 15:57:37 +0000 (Mon, 01 Sep 2008) Log Message: ----------- fix for Python 2.4 Modified Paths: -------------- trunk/pyjsl/warnings.py Modified: trunk/pyjsl/warnings.py =================================================================== --- trunk/pyjsl/warnings.py 2008-09-01 14:04:10 UTC (rev 236) +++ trunk/pyjsl/warnings.py 2008-09-01 15:57:37 UTC (rev 237) @@ -138,8 +138,10 @@ exit_points.remove(None) # Convert "break" into None - exit_points = set(map(lambda node: node \ - if node and node.kind != tok.BREAK else None, exit_points)) + def break_to_none(node): + if node and node.kind != tok.BREAK: + return node + exit_points = set(map(break_to_none, exit_points)) # Check if the switch had a default case if not switch_has_default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |