[javascriptlint-commit] SF.net SVN: javascriptlint:[381] trunk
Status: Beta
Brought to you by:
matthiasmiller
From: <mat...@us...> - 2018-06-10 05:55:24
|
Revision: 381 http://sourceforge.net/p/javascriptlint/code/381 Author: matthiasmiller Date: 2018-06-10 05:55:22 +0000 (Sun, 10 Jun 2018) Log Message: ----------- Rename warning for clarity; add test. Modified Paths: -------------- trunk/javascriptlint/lintwarnings.py trunk/tests/warnings/for_in_missing_identifier.js Added Paths: ----------- trunk/tests/warnings/unexpected_not.js Modified: trunk/javascriptlint/lintwarnings.py =================================================================== --- trunk/javascriptlint/lintwarnings.py 2018-06-10 05:46:15 UTC (rev 380) +++ trunk/javascriptlint/lintwarnings.py 2018-06-10 05:55:22 UTC (rev 381) @@ -107,7 +107,7 @@ 'e4x_deprecated': 'e4x is deprecated', 'ambiguous_numeric_prop': 'numeric property should be normalized; use {normalized}', 'duplicate_property': 'duplicate property in object initializer', - 'ambiguous_not': 'the ! operator is ambiguous; use clarifying parentheses' + 'unexpected_not': 'the ! operator is unexpected; use clarifying parentheses' } errors = { @@ -688,7 +688,7 @@ raise LintWarning(node) @lookfor((tok.UNARYOP, op.NOT)) -def ambiguous_not(node): +def unexpected_not(node): # Avoid for(!s in o) if node.parent and node.parent.kind == tok.IN: raise LintWarning(node) Modified: trunk/tests/warnings/for_in_missing_identifier.js =================================================================== --- trunk/tests/warnings/for_in_missing_identifier.js 2018-06-10 05:46:15 UTC (rev 380) +++ trunk/tests/warnings/for_in_missing_identifier.js 2018-06-10 05:55:22 UTC (rev 381) @@ -7,6 +7,6 @@ for (var prop2 in o) o[prop2]++; - for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:ambiguous_not*/ + for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:unexpected_not*/ o[prop]++; } Added: trunk/tests/warnings/unexpected_not.js =================================================================== --- trunk/tests/warnings/unexpected_not.js (rev 0) +++ trunk/tests/warnings/unexpected_not.js 2018-06-10 05:55:22 UTC (rev 381) @@ -0,0 +1,26 @@ +function unexpected_not() { + var i, j; + var f, s, o; + + if (!i == -1) { /*warning:unexpected_not*/ + return false; + } + + if (!f() < -1) { /*warning:unexpected_not*/ + return false; + } + + if (!i != -1) { /*warning:unexpected_not*/ + return false; + } + + if (i != -1 || !j == -1) { /*warning:unexpected_not*/ + return false; + } + + if (!s in o) { /*warning:unexpected_not*/ + return false; + } + + return true; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |