javascriptlint-commit Mailing List for JavaScript Lint
Status: Beta
Brought to you by:
matthiasmiller
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
(42) |
Apr
(15) |
May
(2) |
Jun
|
Jul
|
Aug
(33) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(43) |
Nov
(4) |
Dec
(1) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(20) |
Oct
(23) |
Nov
|
Dec
(1) |
| 2014 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(18) |
| 2018 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <mat...@us...> - 2018-06-13 17:09:16
|
Revision: 387
http://sourceforge.net/p/javascriptlint/code/387
Author: matthiasmiller
Date: 2018-06-13 17:09:14 +0000 (Wed, 13 Jun 2018)
Log Message:
-----------
Tweak warning message for unexpected_not_comparison
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2018-06-13 13:54:50 UTC (rev 386)
+++ trunk/javascriptlint/lintwarnings.py 2018-06-13 17:09:14 UTC (rev 387)
@@ -108,7 +108,7 @@
'ambiguous_numeric_prop': 'numeric property should be normalized; use {normalized}',
'duplicate_property': 'duplicate property in object initializer',
'unexpected_not_in': 'the ! operator is unexpected; add clarifying parentheses',
- 'unexpected_not_comparison': 'the ! operator is unexpected; add clarifying parentheses or compare against !!',
+ 'unexpected_not_comparison': 'the ! operator is unexpected; add clarifying parentheses or rewrite the comparison',
}
errors = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-06-13 13:54:52
|
Revision: 386
http://sourceforge.net/p/javascriptlint/code/386
Author: matthiasmiller
Date: 2018-06-13 13:54:50 +0000 (Wed, 13 Jun 2018)
Log Message:
-----------
Rename "unexpected_not_for_in" to "unexpected_not_in".
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
trunk/tests/warnings/for_in_missing_identifier.js
trunk/tests/warnings/unexpected_not_comparison.js
Added Paths:
-----------
trunk/tests/warnings/unexpected_not_in.js
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2018-06-10 20:41:58 UTC (rev 385)
+++ trunk/javascriptlint/lintwarnings.py 2018-06-13 13:54:50 UTC (rev 386)
@@ -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',
- 'unexpected_not_for_in': 'the ! operator is unexpected; add clarifying parentheses',
+ 'unexpected_not_in': 'the ! operator is unexpected; add clarifying parentheses',
'unexpected_not_comparison': 'the ! operator is unexpected; add clarifying parentheses or compare against !!',
}
@@ -692,7 +692,7 @@
raise LintWarning(node)
@lookfor((tok.UNARYOP, op.NOT))
-def unexpected_not_for_in(node):
+def unexpected_not_in(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 20:41:58 UTC (rev 385)
+++ trunk/tests/warnings/for_in_missing_identifier.js 2018-06-13 13:54:50 UTC (rev 386)
@@ -7,6 +7,6 @@
for (var prop2 in o)
o[prop2]++;
- for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:unexpected_not_for_in*/
+ for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:unexpected_not_in*/
o[prop]++;
}
Modified: trunk/tests/warnings/unexpected_not_comparison.js
===================================================================
--- trunk/tests/warnings/unexpected_not_comparison.js 2018-06-10 20:41:58 UTC (rev 385)
+++ trunk/tests/warnings/unexpected_not_comparison.js 2018-06-13 13:54:50 UTC (rev 386)
@@ -18,10 +18,6 @@
return false;
}
- if (!s in o) { /*warning:unexpected_not_for_in*/
- return false;
- }
-
// Allow ! and !!
if (!!i == b) {
return false;
Added: trunk/tests/warnings/unexpected_not_in.js
===================================================================
--- trunk/tests/warnings/unexpected_not_in.js (rev 0)
+++ trunk/tests/warnings/unexpected_not_in.js 2018-06-13 13:54:50 UTC (rev 386)
@@ -0,0 +1,18 @@
+function unexpected_not_in() {
+ var s, o;
+
+ if (!s in o) { /*warning:unexpected_not_in*/
+ return false;
+ }
+
+ if (!(s in o)) {
+ return false;
+ }
+
+ // Strange, but...if you really want to...
+ if ((!s) in o) {
+ return false;
+ }
+
+ return true;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-06-10 20:42:01
|
Revision: 385
http://sourceforge.net/p/javascriptlint/code/385
Author: matthiasmiller
Date: 2018-06-10 20:41:58 +0000 (Sun, 10 Jun 2018)
Log Message:
-----------
Respect escaping within regular expressions.
Modified Paths:
--------------
trunk/jsengine/parser/__init__.py
trunk/jsengine/tokenizer/__init__.py
trunk/tests/warnings/misplaced_regex.js
Modified: trunk/jsengine/parser/__init__.py
===================================================================
--- trunk/jsengine/parser/__init__.py 2018-06-10 20:26:59 UTC (rev 384)
+++ trunk/jsengine/parser/__init__.py 2018-06-10 20:41:58 UTC (rev 385)
@@ -853,6 +853,15 @@
self.assertEqual(error.offset, 5)
else:
self.assert_(False)
+ try:
+ # Do not allow after an escape sequence, either.
+ parsestring('re = /[\\\n');
+ except JSSyntaxError as error:
+ self.assertEqual(error.offset, 5)
+ else:
+ self.assert_(False)
+ def testRegExpBugReport(self):
+ parsestring('validity = /[^\[\]/]/g')
def testUnterminatedComment(self):
try:
parsestring('/*')
Modified: trunk/jsengine/tokenizer/__init__.py
===================================================================
--- trunk/jsengine/tokenizer/__init__.py 2018-06-10 20:26:59 UTC (rev 384)
+++ trunk/jsengine/tokenizer/__init__.py 2018-06-10 20:41:58 UTC (rev 385)
@@ -215,10 +215,16 @@
return Token(tok.ERROR)
elif c == _Char.ord('['):
while True:
+ # Handle escaped characters, but don't allow line breaks after the escape.
c = stream.readchr()
+ escaped = False
+ if c == _Char.ord('\\'):
+ c = stream.readchr()
+ escaped = True
+
if c == _Char.ord('\n'):
return Token(tok.ERROR)
- elif c == _Char.ord(']'):
+ elif c == _Char.ord(']') and not escaped:
break
elif c == _Char.ord('\n'):
return Token(tok.ERROR)
Modified: trunk/tests/warnings/misplaced_regex.js
===================================================================
--- trunk/tests/warnings/misplaced_regex.js 2018-06-10 20:26:59 UTC (rev 384)
+++ trunk/tests/warnings/misplaced_regex.js 2018-06-10 20:41:58 UTC (rev 385)
@@ -21,6 +21,9 @@
i += /\/\./; /*warning:misplaced_regex*/
i = -/.*/; /*warning:misplaced_regex*/
+ /* legal usage */
+ var validity = /[^\[\]/]/g;
+
/* legal usage: return */
return /\/\./;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-06-10 20:27:00
|
Revision: 384
http://sourceforge.net/p/javascriptlint/code/384
Author: matthiasmiller
Date: 2018-06-10 20:26:59 +0000 (Sun, 10 Jun 2018)
Log Message:
-----------
Fix the useless assignment warning.
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
trunk/tests/warnings/useless_assign.js
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2018-06-10 20:17:00 UTC (rev 383)
+++ trunk/javascriptlint/lintwarnings.py 2018-06-10 20:26:59 UTC (rev 384)
@@ -473,11 +473,14 @@
@lookfor((tok.NAME, op.SETNAME))
def useless_assign(node):
- if node.parent.kind == tok.ASSIGN:
+ if node.parent.kind == tok.ASSIGN and node.parent.opcode not in (op.MUL, op.ADD, op.LSH,
+ op.RSH, op.URSH):
assert node.node_index == 0
value = node.parent.kids[1]
elif node.parent.kind == tok.VAR:
value = node.kids[0]
+ else:
+ value = None
if value and value.kind == tok.NAME and node.atom == value.atom:
raise LintWarning(node)
Modified: trunk/tests/warnings/useless_assign.js
===================================================================
--- trunk/tests/warnings/useless_assign.js 2018-06-10 20:17:00 UTC (rev 383)
+++ trunk/tests/warnings/useless_assign.js 2018-06-10 20:26:59 UTC (rev 384)
@@ -17,4 +17,19 @@
for (; ; i = i) { /*warning:useless_assign*/
i++;
}
+
+ // These could conceivably be meaningful.
+ i *= i;
+ i += i;
+ i >>= i;
+ i <<= i;
+ i >>>= i;
+
+ // These make no sense.
+ i /= i; /*warning:useless_assign*/
+ i -= i; /*warning:useless_assign*/
+ i %= i; /*warning:useless_assign*/
+ i &= i; /*warning:useless_assign*/
+ i |= i; /*warning:useless_assign*/
+ i ^= i; /*warning:useless_assign*/
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-06-10 20:17:01
|
Revision: 383
http://sourceforge.net/p/javascriptlint/code/383
Author: matthiasmiller
Date: 2018-06-10 20:17:00 +0000 (Sun, 10 Jun 2018)
Log Message:
-----------
Fix traceback when dumping loops.
Modified Paths:
--------------
trunk/javascriptlint/jsparse.py
Modified: trunk/javascriptlint/jsparse.py
===================================================================
--- trunk/javascriptlint/jsparse.py 2018-06-10 20:14:03 UTC (rev 382)
+++ trunk/javascriptlint/jsparse.py 2018-06-10 20:17:00 UTC (rev 383)
@@ -113,8 +113,9 @@
print ' '*depth,
print '%s, %s' % (repr(node.kind), repr(node.opcode))
print ' '*depth,
- print '%s - %s' % (node_positions.from_offset(node.start_offset),
- node_positions.from_offset(node.end_offset))
+ if node.kind != tok.RESERVED:
+ print '%s - %s' % (node_positions.from_offset(node.start_offset),
+ node_positions.from_offset(node.end_offset))
if hasattr(node, 'atom'):
print ' '*depth,
print 'atom: %s' % node.atom
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-06-10 20:14:05
|
Revision: 382
http://sourceforge.net/p/javascriptlint/code/382
Author: matthiasmiller
Date: 2018-06-10 20:14:03 +0000 (Sun, 10 Jun 2018)
Log Message:
-----------
Split into two separate warnings.
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
trunk/tests/warnings/for_in_missing_identifier.js
Added Paths:
-----------
trunk/tests/warnings/unexpected_not_comparison.js
Removed Paths:
-------------
trunk/tests/warnings/unexpected_not.js
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2018-06-10 05:55:22 UTC (rev 381)
+++ trunk/javascriptlint/lintwarnings.py 2018-06-10 20:14:03 UTC (rev 382)
@@ -107,7 +107,8 @@
'e4x_deprecated': 'e4x is deprecated',
'ambiguous_numeric_prop': 'numeric property should be normalized; use {normalized}',
'duplicate_property': 'duplicate property in object initializer',
- 'unexpected_not': 'the ! operator is unexpected; use clarifying parentheses'
+ 'unexpected_not_for_in': 'the ! operator is unexpected; add clarifying parentheses',
+ 'unexpected_not_comparison': 'the ! operator is unexpected; add clarifying parentheses or compare against !!',
}
errors = {
@@ -688,15 +689,34 @@
raise LintWarning(node)
@lookfor((tok.UNARYOP, op.NOT))
-def unexpected_not(node):
+def unexpected_not_for_in(node):
# Avoid for(!s in o)
if node.parent and node.parent.kind == tok.IN:
raise LintWarning(node)
+@lookfor((tok.UNARYOP, op.NOT))
+def unexpected_not_comparison(node):
# Avoid use in comparisons.
- if node.parent and node.parent.kind in (tok.EQOP, tok.RELOP):
+ if node.parent and node.parent.kind == tok.RELOP:
raise LintWarning(node)
+ if node.parent and node.parent.kind == tok.EQOP:
+ # Allow !!
+ kid, = node.kids
+ if kid.kind == tok.UNARYOP and kid.opcode == op.NOT:
+ return
+
+ # Allow when compared against !
+ for i, kid in enumerate(node.parent.kids):
+ if i == node.node_index:
+ continue
+ if kid.kind != tok.UNARYOP or kid.opcode != op.NOT:
+ break
+ else:
+ return
+
+ raise LintWarning(node)
+
def _get_function_property_name(node):
# Ignore function statements.
if node.opcode in (None, op.CLOSURE):
Modified: trunk/tests/warnings/for_in_missing_identifier.js
===================================================================
--- trunk/tests/warnings/for_in_missing_identifier.js 2018-06-10 05:55:22 UTC (rev 381)
+++ trunk/tests/warnings/for_in_missing_identifier.js 2018-06-10 20:14:03 UTC (rev 382)
@@ -7,6 +7,6 @@
for (var prop2 in o)
o[prop2]++;
- for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:unexpected_not*/
+ for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:unexpected_not_for_in*/
o[prop]++;
}
Deleted: trunk/tests/warnings/unexpected_not.js
===================================================================
--- trunk/tests/warnings/unexpected_not.js 2018-06-10 05:55:22 UTC (rev 381)
+++ trunk/tests/warnings/unexpected_not.js 2018-06-10 20:14:03 UTC (rev 382)
@@ -1,26 +0,0 @@
-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;
-}
Copied: trunk/tests/warnings/unexpected_not_comparison.js (from rev 381, trunk/tests/warnings/unexpected_not.js)
===================================================================
--- trunk/tests/warnings/unexpected_not_comparison.js (rev 0)
+++ trunk/tests/warnings/unexpected_not_comparison.js 2018-06-10 20:14:03 UTC (rev 382)
@@ -0,0 +1,51 @@
+function unexpected_not_comparison() {
+ var i, j;
+ var b, f, s, o;
+
+ if (!i == -1) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+
+ if (!f() < -1) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+
+ if (!i != -1) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+
+ if (i != -1 || !j == -1) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+
+ if (!s in o) { /*warning:unexpected_not_for_in*/
+ return false;
+ }
+
+ // Allow ! and !!
+ if (!!i == b) {
+ return false;
+ }
+ if (b == !!i) {
+ return false;
+ }
+ if (b === !i) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+ if (!i === b) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+ if (!!b === !i) {
+ return false;
+ }
+ if (!i === !!b) {
+ return false;
+ }
+
+ // Do not allow !! for relative comparison
+ if (!!i <= b) { /*warning:unexpected_not_comparison*/
+ return false;
+ }
+
+ return true;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <mat...@us...> - 2018-06-10 05:46:18
|
Revision: 380
http://sourceforge.net/p/javascriptlint/code/380
Author: matthiasmiller
Date: 2018-06-10 05:46:15 +0000 (Sun, 10 Jun 2018)
Log Message:
-----------
Add a warning against invalid ! usage
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
trunk/tests/warnings/for_in_missing_identifier.js
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2018-01-02 22:12:15 UTC (rev 379)
+++ trunk/javascriptlint/lintwarnings.py 2018-06-10 05:46:15 UTC (rev 380)
@@ -107,6 +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'
}
errors = {
@@ -686,6 +687,16 @@
return # Allow as constructors
raise LintWarning(node)
+@lookfor((tok.UNARYOP, op.NOT))
+def ambiguous_not(node):
+ # Avoid for(!s in o)
+ if node.parent and node.parent.kind == tok.IN:
+ raise LintWarning(node)
+
+ # Avoid use in comparisons.
+ if node.parent and node.parent.kind in (tok.EQOP, tok.RELOP):
+ raise LintWarning(node)
+
def _get_function_property_name(node):
# Ignore function statements.
if node.opcode in (None, op.CLOSURE):
Modified: trunk/tests/warnings/for_in_missing_identifier.js
===================================================================
--- trunk/tests/warnings/for_in_missing_identifier.js 2018-01-02 22:12:15 UTC (rev 379)
+++ trunk/tests/warnings/for_in_missing_identifier.js 2018-06-10 05:46:15 UTC (rev 380)
@@ -7,6 +7,6 @@
for (var prop2 in o)
o[prop2]++;
- for (!prop in o) /*warning:for_in_missing_identifier*/
+ for (!prop in o) /*warning:for_in_missing_identifier*/ /*warning:ambiguous_not*/
o[prop]++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 22:12:16
|
Revision: 379
http://sourceforge.net/p/javascriptlint/code/379
Author: matthiasmiller
Date: 2018-01-02 22:12:15 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Fix to r378.
Modified Paths:
--------------
trunk/javascriptlint/jsl.py
Modified: trunk/javascriptlint/jsl.py
===================================================================
--- trunk/javascriptlint/jsl.py 2018-01-02 21:55:24 UTC (rev 378)
+++ trunk/javascriptlint/jsl.py 2018-01-02 22:12:15 UTC (rev 379)
@@ -77,9 +77,8 @@
add = parser.add_option
add("--conf", dest="conf", metavar="CONF",
help="set the conf file")
- if hotshot is not None:
- add("--profile", dest="profile", action="store_true", default=False,
- help="turn on hotshot profiling")
+ add("--profile", dest="profile", action="store_true", default=False,
+ help="turn on hotshot profiling" if hotshot is not None else optparse.SUPPRESS_HELP)
add("--recurse", dest="recurse", action="store_true", default=False,
help="recursively search directories on the command line")
if os.name == 'nt':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 21:55:27
|
Revision: 378
http://sourceforge.net/p/javascriptlint/code/378
Author: matthiasmiller
Date: 2018-01-02 21:55:24 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Hide irrelevant command line options.
Modified Paths:
--------------
trunk/javascriptlint/jsl.py
trunk/setup.py
Modified: trunk/javascriptlint/jsl.py
===================================================================
--- trunk/javascriptlint/jsl.py 2018-01-02 21:42:44 UTC (rev 377)
+++ trunk/javascriptlint/jsl.py 2018-01-02 21:55:24 UTC (rev 378)
@@ -1,11 +1,17 @@
#!/usr/bin/python
# vim: ts=4 sw=4 expandtab
+try:
+ import hotshot
+ import hotshot.stats
+except ImportError:
+ hotshot = None
import fnmatch
import functools
+import optparse
import os
import sys
+import tempfile
import unittest
-from optparse import OptionParser
import conf
import fs
@@ -56,9 +62,6 @@
print "Developed by Matthias Miller (http://www.JavaScriptLint.com)"
def _profile_enabled(func, *args, **kwargs):
- import tempfile
- import hotshot
- import hotshot.stats
handle, filename = tempfile.mkstemp()
profile = hotshot.Profile(filename)
profile.runcall(func, *args, **kwargs)
@@ -70,12 +73,13 @@
func(*args, **kwargs)
def _main():
- parser = OptionParser(usage="%prog [options] [files]")
+ parser = optparse.OptionParser(usage="%prog [options] [files]")
add = parser.add_option
add("--conf", dest="conf", metavar="CONF",
help="set the conf file")
- add("--profile", dest="profile", action="store_true", default=False,
- help="turn on hotshot profiling")
+ if hotshot is not None:
+ add("--profile", dest="profile", action="store_true", default=False,
+ help="turn on hotshot profiling")
add("--recurse", dest="recurse", action="store_true", default=False,
help="recursively search directories on the command line")
if os.name == 'nt':
@@ -85,9 +89,9 @@
add("--enable-wildcards", dest="wildcards", action="store_true",
default=False, help="resolve wildcards in the command line")
add("--dump", dest="dump", action="store_true", default=False,
- help="dump this script")
+ help="dump this script" if not hasattr(sys, 'frozen') else optparse.SUPPRESS_HELP)
add("--unittest", dest="unittest", action="store_true", default=False,
- help="run the python unittests")
+ help="run the python unittests" if not hasattr(sys, 'frozen') else optparse.SUPPRESS_HELP)
add("--quiet", dest="verbosity", action="store_const", const=0,
help="minimal output")
add("--verbose", dest="verbosity", action="store_const", const=2,
Modified: trunk/setup.py
===================================================================
--- trunk/setup.py 2018-01-02 21:42:44 UTC (rev 377)
+++ trunk/setup.py 2018-01-02 21:55:24 UTC (rev 378)
@@ -53,7 +53,8 @@
'_ssl',
'_hashlib',
'socket',
- 'select'
+ 'select',
+ 'hotshot',
],
'bundle_files': 1,
'optimize': 1, # requires 1 to preserve docstrings
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 21:42:45
|
Revision: 377
http://sourceforge.net/p/javascriptlint/code/377
Author: matthiasmiller
Date: 2018-01-02 21:42:44 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Remove unnecessary files from the py2exe bundle.
Modified Paths:
--------------
trunk/setup.py
Modified: trunk/setup.py
===================================================================
--- trunk/setup.py 2018-01-02 21:36:45 UTC (rev 376)
+++ trunk/setup.py 2018-01-02 21:42:44 UTC (rev 377)
@@ -47,9 +47,22 @@
console = ['jsl'],
options = {
'py2exe': {
- 'excludes': ['resource'],
+ 'excludes': [
+ 'resource',
+ 'bz2',
+ '_ssl',
+ '_hashlib',
+ 'socket',
+ 'select'
+ ],
'bundle_files': 1,
'optimize': 1, # requires 1 to preserve docstrings
+ 'dll_excludes': [
+ 'mswsock.dll',
+ 'powrprof.dll',
+ 'CRYPT32.dll'
+ ]
+
}
},
zipfile = None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 21:36:46
|
Revision: 376
http://sourceforge.net/p/javascriptlint/code/376
Author: matthiasmiller
Date: 2018-01-02 21:36:45 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Fix exception when running with blank command line.
Modified Paths:
--------------
trunk/javascriptlint/jsl.py
Modified: trunk/javascriptlint/jsl.py
===================================================================
--- trunk/javascriptlint/jsl.py 2018-01-02 21:26:49 UTC (rev 375)
+++ trunk/javascriptlint/jsl.py 2018-01-02 21:36:45 UTC (rev 376)
@@ -18,7 +18,7 @@
_lint_results = {
'warning': 0,
- 'errors': 0
+ 'error': 0
}
def _dump(paths, encoding):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 21:26:52
|
Revision: 375
http://sourceforge.net/p/javascriptlint/code/375
Author: matthiasmiller
Date: 2018-01-02 21:26:49 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Add a configuration setting for additional include directories.
Modified Paths:
--------------
trunk/javascriptlint/conf.py
trunk/javascriptlint/lint.py
trunk/test.py
Added Paths:
-----------
trunk/tests/path_resolution/include_dir.js
trunk/tests/path_resolution/include_dir_a/
trunk/tests/path_resolution/include_dir_a/import_helper.js
trunk/tests/path_resolution/include_dir_b/
trunk/tests/path_resolution/include_dir_b/import_helper.js
trunk/tests/path_resolution/include_dir_b/import_helper_b.js
Modified: trunk/javascriptlint/conf.py
===================================================================
--- trunk/javascriptlint/conf.py 2018-01-02 21:20:15 UTC (rev 374)
+++ trunk/javascriptlint/conf.py 2018-01-02 21:26:49 UTC (rev 375)
@@ -188,6 +188,18 @@
self._conf.loadfile(parm)
self.value = parm
+class IncludeDirSetting(Setting):
+ wants_parm = True
+ wants_dir = True
+ def __init__(self):
+ self.value = []
+ def load(self, enabled, parm, dir):
+ if not dir:
+ raise ConfError('The %s setting is only valid in a configuration file.' % parm)
+
+ abs_dir = os.path.abspath(os.path.join(dir, parm))
+ self.value.append(abs_dir)
+
class Conf:
def __init__(self):
recurse = BooleanSetting(False)
@@ -203,6 +215,7 @@
'process': ProcessSetting(recurse),
'default-version': JSVersionSetting(),
'conf': ConfSetting(self),
+ 'include-dir': IncludeDirSetting(),
# SpiderMonkey warnings
'no_return_value': BooleanSetting(True),
'equal_as_assign': BooleanSetting(True),
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2018-01-02 21:20:15 UTC (rev 374)
+++ trunk/javascriptlint/lint.py 2018-01-02 21:26:49 UTC (rev 375)
@@ -283,12 +283,14 @@
# The user can specify paths using backslashes (such as when
# linting Windows scripts on a posix environment.
import_path = import_path.replace('\\', os.sep)
- import_path = os.path.join(os.path.dirname(path), import_path)
- if os.path.isfile(import_path):
- return lint_file(import_path, 'js', jsversion, encoding)
+ include_dirs = [os.path.dirname(path)] + conf['include-dir']
+ for include_dir in include_dirs:
+ abs_path = os.path.join(include_dir, import_path)
+ if os.path.isfile(abs_path):
+ return lint_file(abs_path, 'js', jsversion, encoding)
_report(offset, 'error', 'io_error', {
- 'error': 'The file could not be found: %s' % import_path
+ 'error': 'The file could not be found in any include paths: %s' % import_path
})
return _Script()
Modified: trunk/test.py
===================================================================
--- trunk/test.py 2018-01-02 21:20:15 UTC (rev 374)
+++ trunk/test.py 2018-01-02 21:26:49 UTC (rev 375)
@@ -21,12 +21,12 @@
class TestError(Exception):
pass
-def _get_conf(script):
+def _get_conf(script, script_dir):
regexp = re.compile(r"/\*conf:([^*]*)\*/")
text = '\n'.join(regexp.findall(script))
conf = javascriptlint.conf.Conf()
- conf.loadtext(_DEFAULT_CONF)
- conf.loadtext(text)
+ conf.loadtext(_DEFAULT_CONF, script_dir)
+ conf.loadtext(text, script_dir)
return conf
def _get_expected_warnings(script):
@@ -45,11 +45,14 @@
return warnings
def _testfile(path):
+ script_dir = os.path.dirname(path)
+ assert os.path.isabs(script_dir)
+
# Parse the script and find the expected warnings.
script = open(path).read()
expected_warnings = _get_expected_warnings(script)
unexpected_warnings = []
- conf = _get_conf(script)
+ conf = _get_conf(script, script_dir)
def lint_error(path, line, col, msg_type, errname, errdesc):
warning = (line, msg_type, errname)
Added: trunk/tests/path_resolution/include_dir.js
===================================================================
--- trunk/tests/path_resolution/include_dir.js (rev 0)
+++ trunk/tests/path_resolution/include_dir.js 2018-01-02 21:26:49 UTC (rev 375)
@@ -0,0 +1,5 @@
+/*conf:+include-dir include_dir_a*/
+
+/*jsl:import import_helper.js*/
+/*jsl:import import_helper_b.js*/ /*error:io_error*/
+import_helper();
Added: trunk/tests/path_resolution/include_dir_a/import_helper.js
===================================================================
--- trunk/tests/path_resolution/include_dir_a/import_helper.js (rev 0)
+++ trunk/tests/path_resolution/include_dir_a/import_helper.js 2018-01-02 21:26:49 UTC (rev 375)
@@ -0,0 +1,2 @@
+function import_helper() {
+}
Added: trunk/tests/path_resolution/include_dir_b/import_helper.js
===================================================================
Added: trunk/tests/path_resolution/include_dir_b/import_helper_b.js
===================================================================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 21:20:18
|
Revision: 374
http://sourceforge.net/p/javascriptlint/code/374
Author: matthiasmiller
Date: 2018-01-02 21:20:15 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Improve error messages with invalid imports.
Modified Paths:
--------------
trunk/javascriptlint/lint.py
Added Paths:
-----------
trunk/tests/path_resolution/missing_import.html
trunk/tests/path_resolution/missing_import.js
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2018-01-02 20:28:00 UTC (rev 373)
+++ trunk/javascriptlint/lint.py 2018-01-02 21:20:15 UTC (rev 374)
@@ -251,6 +251,7 @@
yield {
'type': 'external',
'jsversion': jsversion,
+ 'offset': tag['offset'],
'src': src,
}
elif tag['type'] == 'end':
@@ -278,13 +279,19 @@
def lint_files(paths, lint_error, encoding, conf=conf.Conf(), printpaths=True):
def lint_file(path, kind, jsversion, encoding):
- def import_script(import_path, jsversion):
+ def import_script(offset, import_path, jsversion):
# The user can specify paths using backslashes (such as when
# linting Windows scripts on a posix environment.
import_path = import_path.replace('\\', os.sep)
import_path = os.path.join(os.path.dirname(path), import_path)
- return lint_file(import_path, 'js', jsversion, encoding)
+ if os.path.isfile(import_path):
+ return lint_file(import_path, 'js', jsversion, encoding)
+ _report(offset, 'error', 'io_error', {
+ 'error': 'The file could not be found: %s' % import_path
+ })
+ return _Script()
+
def report_lint(node, errname, offset=0, **errargs):
assert errname in lintwarnings.warnings, errname
if conf[errname]:
@@ -326,7 +333,7 @@
continue
if script['type'] == 'external':
- other = import_script(script['src'], script['jsversion'])
+ other = import_script(script['offset'], script['src'], script['jsversion'])
lint_cache[normpath].importscript(other)
elif script['type'] == 'inline':
script_parts.append((script['offset'], script['jsversion'],
@@ -460,7 +467,7 @@
if not parms:
report(node, 'jsl_cc_not_understood')
else:
- import_paths.append(parms)
+ import_paths.append((node.start_offset, parms))
elif keyword == 'fallthru':
fallthrus.append(node)
elif keyword == 'pass':
@@ -503,8 +510,8 @@
report(fallthru, 'invalid_pass')
# Process imports by copying global declarations into the universal scope.
- for path in import_paths:
- script_cache.importscript(import_callback(path, jsversion))
+ for offset, path in import_paths:
+ script_cache.importscript(import_callback(offset, path, jsversion))
for name, node in declares:
declare_scope = script_cache.scope.find_scope(node)
Added: trunk/tests/path_resolution/missing_import.html
===================================================================
--- trunk/tests/path_resolution/missing_import.html (rev 0)
+++ trunk/tests/path_resolution/missing_import.html 2018-01-02 21:20:15 UTC (rev 374)
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <script src="file_does_not_exist.js"></script> <!--/*error:io_error*/-->
+</head>
+<body>
+ <script>
+ /*jsl:import file_does_not_exist.js*/ /*error:io_error*/
+ </script>
+</body>
+</html>
Added: trunk/tests/path_resolution/missing_import.js
===================================================================
--- trunk/tests/path_resolution/missing_import.js (rev 0)
+++ trunk/tests/path_resolution/missing_import.js 2018-01-02 21:20:15 UTC (rev 374)
@@ -0,0 +1 @@
+/*jsl:import file_does_not_exist.js*/ /*error:io_error*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2018-01-02 20:28:01
|
Revision: 373
http://sourceforge.net/p/javascriptlint/code/373
Author: matthiasmiller
Date: 2018-01-02 20:28:00 +0000 (Tue, 02 Jan 2018)
Log Message:
-----------
Fix missing parameter in lint_files.
Modified Paths:
--------------
trunk/javascriptlint/lint.py
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2016-12-30 22:51:46 UTC (rev 372)
+++ trunk/javascriptlint/lint.py 2018-01-02 20:28:00 UTC (rev 373)
@@ -311,7 +311,7 @@
try:
contents = fs.readfile(path, encoding)
except IOError, error:
- lint_error(normpath, 0, 0, 'io_error', unicode(error))
+ lint_error(normpath, 0, 0, 'error', 'io_error', unicode(error))
return lint_cache[normpath]
node_positions = jsparse.NodePositions(contents)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-30 22:51:49
|
Revision: 372
http://sourceforge.net/p/javascriptlint/code/372
Author: matthiasmiller
Date: 2016-12-30 22:51:46 +0000 (Fri, 30 Dec 2016)
Log Message:
-----------
Stop hiding the fact that ambiguous_else_stmt is on the statement line, not on the "else".
Modified Paths:
--------------
trunk/test.py
trunk/tests/warnings/ambiguous_else_stmt.js
Modified: trunk/test.py
===================================================================
--- trunk/test.py 2016-12-30 22:48:30 UTC (rev 371)
+++ trunk/test.py 2016-12-30 22:51:46 UTC (rev 372)
@@ -53,12 +53,6 @@
def lint_error(path, line, col, msg_type, errname, errdesc):
warning = (line, msg_type, errname)
-
- # Bad hack to fix line numbers on ambiguous else statements
- # TODO: Fix tests.
- if errname == 'ambiguous_else_stmt' and not warning in expected_warnings:
- warning = (line-1, msg_type, errname)
-
if warning in expected_warnings:
expected_warnings.remove(warning)
else:
Modified: trunk/tests/warnings/ambiguous_else_stmt.js
===================================================================
--- trunk/tests/warnings/ambiguous_else_stmt.js 2016-12-30 22:48:30 UTC (rev 371)
+++ trunk/tests/warnings/ambiguous_else_stmt.js 2016-12-30 22:51:46 UTC (rev 372)
@@ -16,6 +16,6 @@
while (j) /*warning:ambiguous_nested_stmt*/
if (y) /*warning:ambiguous_nested_stmt*/
y--;
- else /*warning:ambiguous_else_stmt*/
- y++;
+ else
+ y++; /*warning:ambiguous_else_stmt*/
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-30 22:48:35
|
Revision: 371
http://sourceforge.net/p/javascriptlint/code/371
Author: matthiasmiller
Date: 2016-12-30 22:48:30 +0000 (Fri, 30 Dec 2016)
Log Message:
-----------
Properly distinguish between errors and warnings.
Modified Paths:
--------------
trunk/javascriptlint/jsl.py
trunk/javascriptlint/lint.py
trunk/test.py
trunk/tests/conf/jscript_function_extensions-3.js
trunk/tests/conf/jscript_function_extensions-4.js
trunk/tests/control_comments/conf-version-2.js
trunk/tests/control_comments/conf-version.js
trunk/tests/errors/expected_tok.js
trunk/tests/errors/syntax_error.js
trunk/tests/html/e4x.html
Modified: trunk/javascriptlint/jsl.py
===================================================================
--- trunk/javascriptlint/jsl.py 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/javascriptlint/jsl.py 2016-12-30 22:48:30 UTC (rev 371)
@@ -17,7 +17,7 @@
import version
_lint_results = {
- 'warnings': 0,
+ 'warning': 0,
'errors': 0
}
@@ -26,8 +26,9 @@
script = fs.readfile(path, encoding)
jsparse.dump_tree(script)
-def _lint_warning(conf_, path, line, col, errname, errdesc):
- _lint_results['warnings'] = _lint_results['warnings'] + 1
+def _lint_warning(conf_, path, line, col, msg_type, errname, errdesc):
+ assert msg_type in ('warning', 'error')
+ _lint_results[msg_type] += 1
print util.format_error(conf_['output-format'], path, line, col,
errname, errdesc)
@@ -120,7 +121,7 @@
try:
conf_.loadfile(options.conf)
except conf.ConfError, error:
- _lint_warning(conf_, error.path, error.lineno, 0, 'conf_error',
+ _lint_warning(conf_, error.path, error.lineno, 0, 'error', 'conf_error',
unicode(error))
profile_func = _profile_disabled
@@ -151,12 +152,12 @@
profile_func(_lint, paths, conf_, options.printlisting, options.encoding)
if options.printsummary:
- print '\n%i error(s), %i warnings(s)' % (_lint_results['errors'],
- _lint_results['warnings'])
+ print '\n%i error(s), %i warnings(s)' % (_lint_results['error'],
+ _lint_results['warning'])
- if _lint_results['errors']:
+ if _lint_results['error']:
sys.exit(3)
- if _lint_results['warnings']:
+ if _lint_results['warning']:
sys.exit(1)
sys.exit(0)
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/javascriptlint/lint.py 2016-12-30 22:48:30 UTC (rev 371)
@@ -288,18 +288,18 @@
def report_lint(node, errname, offset=0, **errargs):
assert errname in lintwarnings.warnings, errname
if conf[errname]:
- _report(offset or node.start_offset, errname, errargs)
+ _report(offset or node.start_offset, 'warning', errname, errargs)
def report_parse_error(offset, errname, errargs):
assert errname in lintwarnings.errors, errname
- _report(offset, errname, errargs)
+ _report(offset, 'error', errname, errargs)
- def _report(offset, errname, errargs):
+ def _report(offset, msg_type, errname, errargs):
errdesc = lintwarnings.format_error(errname, **errargs)
if lint_cache[normpath].should_ignore(offset):
return
pos = node_positions.from_offset(offset)
- return lint_error(normpath, pos.line, pos.col, errname, errdesc)
+ return lint_error(normpath, pos.line, pos.col, msg_type, errname, errdesc)
normpath = fs.normpath(path)
if normpath in lint_cache:
Modified: trunk/test.py
===================================================================
--- trunk/test.py 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/test.py 2016-12-30 22:48:30 UTC (rev 371)
@@ -33,15 +33,15 @@
"returns an array of tuples -- line, warning"
warnings = []
- regexp = re.compile(r"/\*warning:([^*]*)\*/")
+ regexp = re.compile(r"/\*(error|warning):([^*]*)\*/")
lines = script.splitlines()
for i in range(0, len(lines)):
- for warning in regexp.findall(lines[i]):
+ for msg_type, warning in regexp.findall(lines[i]):
# TODO: implement these
unimpl_warnings = ('dup_option_explicit',)
if not warning in unimpl_warnings:
- warnings.append((i, warning))
+ warnings.append((i, msg_type, warning))
return warnings
def _testfile(path):
@@ -51,13 +51,13 @@
unexpected_warnings = []
conf = _get_conf(script)
- def lint_error(path, line, col, errname, errdesc):
- warning = (line, errname)
+ def lint_error(path, line, col, msg_type, errname, errdesc):
+ warning = (line, msg_type, errname)
# Bad hack to fix line numbers on ambiguous else statements
# TODO: Fix tests.
if errname == 'ambiguous_else_stmt' and not warning in expected_warnings:
- warning = (line-1, errname)
+ warning = (line-1, msg_type, errname)
if warning in expected_warnings:
expected_warnings.remove(warning)
@@ -69,11 +69,11 @@
errors = []
if expected_warnings:
errors.append('Expected warnings:')
- for line, warning in expected_warnings:
+ for line, msg_type, warning in expected_warnings:
errors.append('\tline %i: %s' % (line+1, warning))
if unexpected_warnings:
errors.append('Unexpected warnings:')
- for line, warning, errdesc in unexpected_warnings:
+ for line, msg_type, warning, errdesc in unexpected_warnings:
errors.append('\tline %i: %s/%s' % (line+1, warning, errdesc))
if errors:
raise TestError('\n'.join(errors))
Modified: trunk/tests/conf/jscript_function_extensions-3.js
===================================================================
--- trunk/tests/conf/jscript_function_extensions-3.js 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/conf/jscript_function_extensions-3.js 2016-12-30 22:48:30 UTC (rev 371)
@@ -23,5 +23,5 @@
this.val = null;
}
-function conf.jscript_function_extensions..ok(val) { /*warning:syntax_error*/
+function conf.jscript_function_extensions..ok(val) { /*error:syntax_error*/
}
Modified: trunk/tests/conf/jscript_function_extensions-4.js
===================================================================
--- trunk/tests/conf/jscript_function_extensions-4.js 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/conf/jscript_function_extensions-4.js 2016-12-30 22:48:30 UTC (rev 371)
@@ -1,4 +1,4 @@
/*conf:+jscript_function_extensions*/
-function conf.jscript_function_extensions:onunload(val) { /*warning:syntax_error*/
+function conf.jscript_function_extensions:onunload(val) { /*error:syntax_error*/
}
Modified: trunk/tests/control_comments/conf-version-2.js
===================================================================
--- trunk/tests/control_comments/conf-version-2.js 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/control_comments/conf-version-2.js 2016-12-30 22:48:30 UTC (rev 371)
@@ -3,5 +3,5 @@
/* Make sure that the control comment overrides the config file. */
function default_version() {
- yield true; /*warning:semi_before_stmnt*/
+ yield true; /*error:semi_before_stmnt*/
}
Modified: trunk/tests/control_comments/conf-version.js
===================================================================
--- trunk/tests/control_comments/conf-version.js 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/control_comments/conf-version.js 2016-12-30 22:48:30 UTC (rev 371)
@@ -1,5 +1,5 @@
/*conf:+default-version text/javascript;version=1.7*/
function default_version() {
// TODO: Support js1.7
- yield true; /*warning:semi_before_stmnt*/
+ yield true; /*error:semi_before_stmnt*/
}
Modified: trunk/tests/errors/expected_tok.js
===================================================================
--- trunk/tests/errors/expected_tok.js 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/errors/expected_tok.js 2016-12-30 22:48:30 UTC (rev 371)
@@ -1,4 +1,4 @@
function expected_tok() {
- return { a, }; /*warning:expected_tok*/
+ return { a, }; /*error:expected_tok*/
}
Modified: trunk/tests/errors/syntax_error.js
===================================================================
--- trunk/tests/errors/syntax_error.js 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/errors/syntax_error.js 2016-12-30 22:48:30 UTC (rev 371)
@@ -1,4 +1,4 @@
function syntax_error() {
- &; /*warning:syntax_error*/
+ &; /*error:syntax_error*/
}
Modified: trunk/tests/html/e4x.html
===================================================================
--- trunk/tests/html/e4x.html 2016-12-29 22:10:19 UTC (rev 370)
+++ trunk/tests/html/e4x.html 2016-12-30 22:48:30 UTC (rev 371)
@@ -7,19 +7,19 @@
<script type="text/javascript">
// e4x is disabled by default, so HTML comments are single-line only.
var comment_a = <!--
- ? /*warning:syntax_error*/
+ ? /*error:syntax_error*/
-->;
</script>
<script type="text/javascript;e4x=1">/*warning:e4x_deprecated*/
// Explicitly enable e4x.
var comment_c = <!--
- ? /*warning:syntax_error*/
+ ? /*error:syntax_error*/
-->;
</script>
<script type="text/javascript;version=1.6;e4x=0">
// e4x is always enabled in 1.6+
var comment_b = <!--
- ? /*warning:syntax_error*/
+ ? /*error:syntax_error*/
-->;
</script>
</head>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-29 22:10:21
|
Revision: 370
http://sourceforge.net/p/javascriptlint/code/370
Author: matthiasmiller
Date: 2016-12-29 22:10:19 +0000 (Thu, 29 Dec 2016)
Log Message:
-----------
Refactor property name functions into utility module.
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
Added Paths:
-----------
trunk/jsengine/js_util.py
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2016-12-29 21:57:52 UTC (rev 369)
+++ trunk/javascriptlint/lintwarnings.py 2016-12-29 22:10:19 UTC (rev 370)
@@ -19,6 +19,7 @@
import util
+from jsengine import js_util
from jsengine.parser import kind as tok
from jsengine.parser import op
@@ -636,44 +637,22 @@
if not left.kind in (tok.VAR, tok.NAME):
raise LintWarning(left)
-def _normalized_number(node):
- assert node.kind == tok.NUMBER
- if node.atom.startswith('0x'):
- value = int(node.atom, 16)
- else:
- value = float(node.atom)
- if value.is_integer():
- value = int(value)
- return str(value)
-
@lookfor(tok.NUMBER)
def ambiguous_numeric_prop(node):
- normalized = _normalized_number(node)
+ normalized = js_util.numeric_property_str(node)
if (node.node_index == 0 and node.parent.kind == tok.COLON) or \
(node.node_index == 1 and node.parent.kind == tok.LB):
if normalized != node.atom:
raise LintWarning(node, normalized=normalized)
-def _object_property(node):
- assert node.kind == tok.COLON
-
- left, right = node.kids
- while left.kind == tok.RP:
- left, = left.kids
- if left.kind == tok.NUMBER:
- return _normalized_number(left)
-
- assert left.kind in (tok.STRING, tok.NAME)
- return left.atom
-
@lookfor(tok.COLON)
def duplicate_property(node):
if not node.parent.kind == tok.RC:
return
- node_value = _object_property(node)
+ node_value = js_util.object_property_str(node)
for sibling in node.parent.kids[:node.node_index]:
- sibling_value = _object_property(sibling)
+ sibling_value = js_util.object_property_str(sibling)
if node_value == sibling_value:
raise LintWarning(node)
Added: trunk/jsengine/js_util.py
===================================================================
--- trunk/jsengine/js_util.py (rev 0)
+++ trunk/jsengine/js_util.py 2016-12-29 22:10:19 UTC (rev 370)
@@ -0,0 +1,25 @@
+# vim: ts=4 sw=4 expandtab
+from parser import kind as tok
+
+def numeric_property_str(node):
+ assert node.kind == tok.NUMBER
+ if node.atom.startswith('0x'):
+ value = int(node.atom, 16)
+ else:
+ value = float(node.atom)
+ if value.is_integer():
+ value = int(value)
+ return str(value)
+
+def object_property_str(node):
+ assert node.kind == tok.COLON
+
+ left, right = node.kids
+ while left.kind == tok.RP:
+ left, = left.kids
+ if left.kind == tok.NUMBER:
+ return numeric_property_str(left)
+
+ assert left.kind in (tok.STRING, tok.NAME)
+ return left.atom
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-29 21:57:55
|
Revision: 369
http://sourceforge.net/p/javascriptlint/code/369
Author: matthiasmiller
Date: 2016-12-29 21:57:52 +0000 (Thu, 29 Dec 2016)
Log Message:
-----------
Improve error location for trailing comma error.
Modified Paths:
--------------
trunk/javascriptlint/lint.py
trunk/tests/warnings/trailing_comma_in_array.js
Added Paths:
-----------
trunk/tests/warnings/trailing_comma.js
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2016-12-29 21:50:27 UTC (rev 368)
+++ trunk/javascriptlint/lint.py 2016-12-29 21:57:52 UTC (rev 369)
@@ -556,7 +556,8 @@
except lintwarnings.LintWarning, warning:
# TODO: This is ugly hardcoding to improve the error positioning of
# "missing_semicolon" errors.
- if visitor.warning in ('missing_semicolon', 'missing_semicolon_for_lambda'):
+ if visitor.warning in ('missing_semicolon', 'missing_semicolon_for_lambda',
+ 'trailing_comma', 'trailing_comma_in_array'):
offset = warning.node.end_offset
else:
offset = None
Added: trunk/tests/warnings/trailing_comma.js
===================================================================
--- trunk/tests/warnings/trailing_comma.js (rev 0)
+++ trunk/tests/warnings/trailing_comma.js 2016-12-29 21:57:52 UTC (rev 369)
@@ -0,0 +1,7 @@
+function trailing_comma() {
+ var o = {
+ outer: {
+ inner: 1
+ }, /*warning:trailing_comma*/
+ };
+}
Modified: trunk/tests/warnings/trailing_comma_in_array.js
===================================================================
--- trunk/tests/warnings/trailing_comma_in_array.js 2016-12-29 21:50:27 UTC (rev 368)
+++ trunk/tests/warnings/trailing_comma_in_array.js 2016-12-29 21:57:52 UTC (rev 369)
@@ -13,4 +13,9 @@
2,
3, /*warning:trailing_comma_in_array*/
];
+ a = [
+ {
+ prop: 1
+ }, /*warning:trailing_comma_in_array*/
+ ];
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-29 21:50:29
|
Revision: 368
http://sourceforge.net/p/javascriptlint/code/368
Author: matthiasmiller
Date: 2016-12-29 21:50:27 +0000 (Thu, 29 Dec 2016)
Log Message:
-----------
Add warning against duplicate properties in object initializers
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
trunk/tests/warnings/ambiguous_numeric_prop.js
Added Paths:
-----------
trunk/tests/warnings/duplicate_property.js
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2016-12-29 21:46:51 UTC (rev 367)
+++ trunk/javascriptlint/lintwarnings.py 2016-12-29 21:50:27 UTC (rev 368)
@@ -105,6 +105,7 @@
'trailing_whitespace': 'trailing whitespace',
'e4x_deprecated': 'e4x is deprecated',
'ambiguous_numeric_prop': 'numeric property should be normalized; use {normalized}',
+ 'duplicate_property': 'duplicate property in object initializer',
}
errors = {
@@ -635,20 +636,47 @@
if not left.kind in (tok.VAR, tok.NAME):
raise LintWarning(left)
-@lookfor(tok.NUMBER)
-def ambiguous_numeric_prop(node):
+def _normalized_number(node):
+ assert node.kind == tok.NUMBER
if node.atom.startswith('0x'):
value = int(node.atom, 16)
else:
value = float(node.atom)
if value.is_integer():
value = int(value)
+ return str(value)
+@lookfor(tok.NUMBER)
+def ambiguous_numeric_prop(node):
+ normalized = _normalized_number(node)
if (node.node_index == 0 and node.parent.kind == tok.COLON) or \
(node.node_index == 1 and node.parent.kind == tok.LB):
- if str(value) != node.atom:
- raise LintWarning(node, normalized=str(value))
+ if normalized != node.atom:
+ raise LintWarning(node, normalized=normalized)
+def _object_property(node):
+ assert node.kind == tok.COLON
+
+ left, right = node.kids
+ while left.kind == tok.RP:
+ left, = left.kids
+ if left.kind == tok.NUMBER:
+ return _normalized_number(left)
+
+ assert left.kind in (tok.STRING, tok.NAME)
+ return left.atom
+
+@lookfor(tok.COLON)
+def duplicate_property(node):
+ if not node.parent.kind == tok.RC:
+ return
+
+ node_value = _object_property(node)
+ for sibling in node.parent.kids[:node.node_index]:
+ sibling_value = _object_property(sibling)
+ if node_value == sibling_value:
+ raise LintWarning(node)
+
@lookfor(tok.FUNCTION)
def misplaced_function(node):
# Ignore function statements.
Modified: trunk/tests/warnings/ambiguous_numeric_prop.js
===================================================================
--- trunk/tests/warnings/ambiguous_numeric_prop.js 2016-12-29 21:46:51 UTC (rev 367)
+++ trunk/tests/warnings/ambiguous_numeric_prop.js 2016-12-29 21:50:27 UTC (rev 368)
@@ -1,3 +1,4 @@
+/*conf:-duplicate_property*/
function ambiguous_numeric_prop() {
var a = {
1: '',
Added: trunk/tests/warnings/duplicate_property.js
===================================================================
--- trunk/tests/warnings/duplicate_property.js (rev 0)
+++ trunk/tests/warnings/duplicate_property.js 2016-12-29 21:50:27 UTC (rev 368)
@@ -0,0 +1,13 @@
+/*conf:-useless_quotes*/
+/*conf:-ambiguous_numeric_prop*/
+function duplicate_property() {
+ var o = {
+ a: '',
+ "a": '', /*warning:duplicate_property*/
+ 2.00: '',
+ 2: '', /*warning:duplicate_property*/
+ 3.00: '',
+ '3': '', /*warning:duplicate_property*/
+ 'other': ''
+ };
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-29 21:46:53
|
Revision: 367
http://sourceforge.net/p/javascriptlint/code/367
Author: matthiasmiller
Date: 2016-12-29 21:46:51 +0000 (Thu, 29 Dec 2016)
Log Message:
-----------
Add test for the "ambiguous_numeric_prop" warning.
Added Paths:
-----------
trunk/tests/warnings/ambiguous_numeric_prop.js
Added: trunk/tests/warnings/ambiguous_numeric_prop.js
===================================================================
--- trunk/tests/warnings/ambiguous_numeric_prop.js (rev 0)
+++ trunk/tests/warnings/ambiguous_numeric_prop.js 2016-12-29 21:46:51 UTC (rev 367)
@@ -0,0 +1,15 @@
+function ambiguous_numeric_prop() {
+ var a = {
+ 1: '',
+ 2.0: '', /*warning:ambiguous_numeric_prop*/
+ 2.1: '',
+ 2.2: '',
+ 0x3: '' /*warning:ambiguous_numeric_prop*/
+ };
+
+ a[1] = '';
+ a[2.0] = ''; /*warning:ambiguous_numeric_prop*/
+ a[2.1] = '';
+ a[0x3] = ''; /*warning:ambiguous_numeric_prop*/
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-29 21:35:43
|
Revision: 366
http://sourceforge.net/p/javascriptlint/code/366
Author: matthiasmiller
Date: 2016-12-29 21:35:41 +0000 (Thu, 29 Dec 2016)
Log Message:
-----------
Warn about non-normalized numbers as object properties.
Modified Paths:
--------------
trunk/javascriptlint/lintwarnings.py
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2016-12-23 23:55:18 UTC (rev 365)
+++ trunk/javascriptlint/lintwarnings.py 2016-12-29 21:35:41 UTC (rev 366)
@@ -104,6 +104,7 @@
'function_name_mismatch': 'function name {fn_name} does not match property name {prop_name}',
'trailing_whitespace': 'trailing whitespace',
'e4x_deprecated': 'e4x is deprecated',
+ 'ambiguous_numeric_prop': 'numeric property should be normalized; use {normalized}',
}
errors = {
@@ -634,6 +635,20 @@
if not left.kind in (tok.VAR, tok.NAME):
raise LintWarning(left)
+@lookfor(tok.NUMBER)
+def ambiguous_numeric_prop(node):
+ if node.atom.startswith('0x'):
+ value = int(node.atom, 16)
+ else:
+ value = float(node.atom)
+ if value.is_integer():
+ value = int(value)
+
+ if (node.node_index == 0 and node.parent.kind == tok.COLON) or \
+ (node.node_index == 1 and node.parent.kind == tok.LB):
+ if str(value) != node.atom:
+ raise LintWarning(node, normalized=str(value))
+
@lookfor(tok.FUNCTION)
def misplaced_function(node):
# Ignore function statements.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-23 23:55:20
|
Revision: 365
http://sourceforge.net/p/javascriptlint/code/365
Author: matthiasmiller
Date: 2016-12-23 23:55:18 +0000 (Fri, 23 Dec 2016)
Log Message:
-----------
Use exceptions instead of a callback for parse errors.
Modified Paths:
--------------
trunk/javascriptlint/jsparse.py
trunk/javascriptlint/lint.py
trunk/jsengine/parser/__init__.py
Modified: trunk/javascriptlint/jsparse.py
===================================================================
--- trunk/javascriptlint/jsparse.py 2016-12-23 23:46:55 UTC (rev 364)
+++ trunk/javascriptlint/jsparse.py 2016-12-23 23:55:18 UTC (rev 365)
@@ -4,6 +4,7 @@
import re
import unittest
+from jsengine import JSSyntaxError
import jsengine.parser
from jsengine.parser import kind as tok
from jsengine.parser import op
@@ -51,15 +52,14 @@
# this one was within a string or a regexp.
pos = match.start()+1
-def parse(script, jsversion, error_callback, start_offset=0):
+def parse(script, jsversion, start_offset=0):
""" All node positions will be relative to start_offset. This allows
scripts to be embedded in a file (for example, HTML).
"""
assert not start_offset is None
jsversion = jsversion or JSVersion.default()
assert isvalidversion(jsversion), jsversion
- return jsengine.parser.parse(script, jsversion.version,
- error_callback, start_offset)
+ return jsengine.parser.parse(script, jsversion.version, start_offset)
def filtercomments(possible_comments, root_node):
comment_ignore_ranges = NodeRanges()
@@ -126,15 +126,18 @@
_dump_node(node, node_positions, depth+1)
def dump_tree(script):
- def error_callback(line, col, msg, msg_args):
- print '(%i, %i): %s', (line, col, msg)
- node = parse(script, None, error_callback)
node_positions = NodePositions(script)
+ try:
+ node = parse(script, None)
+ except JSSyntaxError, error:
+ pos = node_positions.from_offset(error.offset)
+ print 'Line %i, Column %i: %s' % (pos.line+1, pos.col+1, error.msg)
+ return
_dump_node(node, node_positions)
class TestComments(unittest.TestCase):
def _test(self, script, expected_comments):
- root = parse(script, None, lambda line, col, msg: None)
+ root = parse(script, None)
comments = findcomments(script, root)
encountered_comments = [node.atom for node in comments]
self.assertEquals(encountered_comments, list(expected_comments))
@@ -239,19 +242,18 @@
class TestLineOffset(unittest.TestCase):
def testErrorPos(self):
def geterror(script, start_offset):
- errors = []
- def onerror(offset, msg, msg_args):
- errors.append((offset, msg, msg_args))
- parse(script, None, onerror, start_offset)
- self.assertEquals(len(errors), 1)
- return errors[0]
+ try:
+ parse(script, None, start_offset)
+ except JSSyntaxError, error:
+ return (error.offset, error.msg, error.msg_args)
+ assert False
self.assertEquals(geterror(' ?', 0), (1, 'syntax_error', {}))
self.assertEquals(geterror('\n ?', 0), (2, 'syntax_error', {}))
self.assertEquals(geterror(' ?', 2), (3, 'syntax_error', {}))
self.assertEquals(geterror('\n ?', 2), (4, 'syntax_error', {}))
def testNodePos(self):
def getnodepos(script, start_offset):
- root = parse(script, None, None, start_offset)
+ root = parse(script, None, start_offset)
self.assertEquals(root.kind, tok.LC)
var, = root.kids
self.assertEquals(var.kind, tok.VAR)
@@ -264,7 +266,7 @@
self.assertEquals(getnodepos('\n\n var x;', 7), 10)
def testComments(self):
def testcomment(comment, startpos, expected_offset):
- root = parse(comment, None, None, startpos)
+ root = parse(comment, None, startpos)
comment, = findcomments(comment, root, startpos)
self.assertEquals(comment.start_offset, expected_offset)
for comment in ('/*comment*/', '//comment'):
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2016-12-23 23:46:55 UTC (rev 364)
+++ trunk/javascriptlint/lint.py 2016-12-23 23:55:18 UTC (rev 365)
@@ -351,9 +351,6 @@
def _lint_script_part(script_offset, jsversion, script, script_cache, conf,
report_parse_error, report_lint, import_callback):
- def parse_error(offset, msg, msg_args):
- parse_errors.append((offset, msg, msg_args))
-
def report(node, errname, offset=0, **errargs):
if errname == 'empty_statement' and node.kind == tok.LC:
for pass_ in passes:
@@ -387,7 +384,6 @@
report_lint(node, errname, offset, **errargs)
- parse_errors = []
declares = []
unused_identifiers = []
import_paths = []
@@ -421,11 +417,11 @@
report_lint(None, 'e4x_deprecated',
jsversionnode.start_offset if jsversionnode else script_offset)
- root = jsparse.parse(script, jsversion, parse_error, script_offset)
- if not root:
+ try:
+ root = jsparse.parse(script, jsversion, script_offset)
+ except jsparse.JSSyntaxError, error:
# Report errors and quit.
- for offset, msg, msg_args in parse_errors:
- report_parse_error(offset, msg, msg_args)
+ report_parse_error(error.offset, error.msg, error.msg_args)
return
comments = jsparse.filtercomments(possible_comments, root)
@@ -487,10 +483,6 @@
if start_ignore:
report(start_ignore, 'mismatch_ctrl_comments')
- # Wait to report parse errors until loading jsl:ignore directives.
- for offset, msg in parse_errors:
- report_parse_error(offset, msg)
-
# Find all visitors and convert them into "onpush" callbacks that call "report"
visitors = {
'push': lintwarnings.make_visitors(conf)
Modified: trunk/jsengine/parser/__init__.py
===================================================================
--- trunk/jsengine/parser/__init__.py 2016-12-23 23:46:55 UTC (rev 364)
+++ trunk/jsengine/parser/__init__.py 2016-12-23 23:55:18 UTC (rev 365)
@@ -814,7 +814,9 @@
nodes = _sourceelements(t, tok.EOF)
lc_end_offset = t.expect(tok.EOF).end_offset
lc_start_offset = nodes[-1].start_offset if nodes else lc_end_offset
- return ParseNode(kind.LC, None, lc_start_offset, lc_end_offset, None, nodes)
+ root = ParseNode(kind.LC, None, lc_start_offset, lc_end_offset, None, nodes)
+ _validate(root)
+ return root
def is_valid_version(version):
return version in _VERSIONS
@@ -825,16 +827,10 @@
assert kid.parent is node
_validate(kid, depth+1)
-def parse(script, jsversion, error_callback, start_offset):
+def parse(script, jsversion, start_offset):
# TODO: respect version
assert is_valid_version(jsversion)
- try:
- root = parsestring(script, start_offset)
- except JSSyntaxError as error:
- error_callback(error.offset, error.msg, error.msg_args)
- return None
- _validate(root)
- return root
+ return parsestring(script, start_offset)
def is_compilable_unit(script, jsversion):
# TODO: respect version
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-23 23:46:57
|
Revision: 364
http://sourceforge.net/p/javascriptlint/code/364
Author: matthiasmiller
Date: 2016-12-23 23:46:55 +0000 (Fri, 23 Dec 2016)
Log Message:
-----------
e4x_deprecated should be a warning, not an error.
Modified Paths:
--------------
trunk/javascriptlint/jsparse.py
trunk/javascriptlint/lint.py
trunk/javascriptlint/lintwarnings.py
Modified: trunk/javascriptlint/jsparse.py
===================================================================
--- trunk/javascriptlint/jsparse.py 2016-12-23 23:38:49 UTC (rev 363)
+++ trunk/javascriptlint/jsparse.py 2016-12-23 23:46:55 UTC (rev 364)
@@ -58,8 +58,6 @@
assert not start_offset is None
jsversion = jsversion or JSVersion.default()
assert isvalidversion(jsversion), jsversion
- if jsversion.e4x:
- error_callback(start_offset, 'e4x_deprecated', {})
return jsengine.parser.parse(script, jsversion.version,
error_callback, start_offset)
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2016-12-23 23:38:49 UTC (rev 363)
+++ trunk/javascriptlint/lint.py 2016-12-23 23:46:55 UTC (rev 364)
@@ -417,6 +417,10 @@
version=jsversion.version)
return
+ if jsversion.e4x:
+ report_lint(None, 'e4x_deprecated',
+ jsversionnode.start_offset if jsversionnode else script_offset)
+
root = jsparse.parse(script, jsversion, parse_error, script_offset)
if not root:
# Report errors and quit.
Modified: trunk/javascriptlint/lintwarnings.py
===================================================================
--- trunk/javascriptlint/lintwarnings.py 2016-12-23 23:38:49 UTC (rev 363)
+++ trunk/javascriptlint/lintwarnings.py 2016-12-23 23:46:55 UTC (rev 364)
@@ -103,10 +103,10 @@
'function_name_missing': 'anonymous function should be named to match property name {name}',
'function_name_mismatch': 'function name {fn_name} does not match property name {prop_name}',
'trailing_whitespace': 'trailing whitespace',
+ 'e4x_deprecated': 'e4x is deprecated',
}
errors = {
- 'e4x_deprecated': 'e4x is deprecated',
'semi_before_stmnt': 'missing semicolon before statement',
'syntax_error': 'syntax error',
'expected_tok': 'expected token: {token}',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2016-12-23 23:38:51
|
Revision: 363
http://sourceforge.net/p/javascriptlint/code/363
Author: matthiasmiller
Date: 2016-12-23 23:38:49 +0000 (Fri, 23 Dec 2016)
Log Message:
-----------
Remove obsolete checks.
Modified Paths:
--------------
trunk/javascriptlint/lint.py
Modified: trunk/javascriptlint/lint.py
===================================================================
--- trunk/javascriptlint/lint.py 2016-12-23 23:35:40 UTC (rev 362)
+++ trunk/javascriptlint/lint.py 2016-12-23 23:38:49 UTC (rev 363)
@@ -352,9 +352,7 @@
def _lint_script_part(script_offset, jsversion, script, script_cache, conf,
report_parse_error, report_lint, import_callback):
def parse_error(offset, msg, msg_args):
- if not msg in ('anon_no_return_value', 'no_return_value',
- 'redeclared_var', 'var_hides_arg'):
- parse_errors.append((offset, msg, msg_args))
+ parse_errors.append((offset, msg, msg_args))
def report(node, errname, offset=0, **errargs):
if errname == 'empty_statement' and node.kind == tok.LC:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|