jeremykohn / closure-linter Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/closure-linter
License: Apache License 2.0
Automatically exported from code.google.com/p/closure-linter
License: Apache License 2.0
What steps will reproduce the problem?
1. Run gjslint or fixjsstyle on a js file containing implied blocks
2.
3.
What is the expected output? What do you see instead?
I would expect implied blocks to be warned by gjslint or by fixjsstyle to be
enclosed in curly braces.
What version of the product are you using? On what operating system?
Using 2.3.1 on ubuntu 10.04LTS.
Please provide any additional information below.
This is more of a feature request than anything. I would like to see gjslint
and fixjsstyle support this. jslint and jshint both have switches for implied
blocks. But all these tools do is complain, really the tool that I find the
most useful is fixjsstyle.
Please don't insult my request or provide non-useful answers such as "this
isn't in google's style guide", or that just ask non-useful questions such as
"why do you want to do that?"
This is a feature that is fully within the capabalities of the codebase and
probably not hard...I just don't know the python to do it or I would myself.
Note that adding curly braces around the type statement in docblocks is
supported, surprisingly to me-- it doesn't seem nearly as useful.
Original issue reported on code.google.com by [email protected]
on 26 Aug 2011 at 8:47
Every so often someone comes along with a convention to write JS files and name
them with an extension other than .js. GJsLint currently filters to only check
.js (and if flagged on .html/.htm) files. Add a flag to specify other suffixes
which should be treated as pure JS files.
Request reported originally to closure-linter-discuss:
"It'd be great to have a flag that allows you to specify extra file
extensions to accept as JavaScript files. ExtendScript, Adobe's
extended JavaScript implementation, has a file extension of .jsx."
Should be fairly easy to implement.
Original issue reported on code.google.com by [email protected]
on 14 Jan 2011 at 12:47
What steps will reproduce the problem?
1. This is a typical an edge case, but /**/ comments are not parsed correctly.
JS and IDE consider these being similar to /* comment */, but Closure Linter
sees a /* instead.
2. Try this code:
/**/
alert ( "not linted" );
/**/
3. Closure lint this script.
What is the expected output? What do you see instead?
It should parse the line in between, but it doesn't.
What version of the product are you using? On what operating system?
Closure Linter 2.3.1
I know this is not a common case, but that would be good if the behavior is the
same as in JS specs.
Original issue reported on code.google.com by edo999
on 26 Aug 2011 at 4:23
What steps will reproduce the problem?
1. Create a file with a "goog.provide('')" statement.
2. Run gjslint --strict -r . on the directory where the file resides.
3. Watch the script fail with the below-mentioned traceback.
What is the expected output? What do you see instead?
Expected output is "invalid use of goog.provide. Must provide something."
Observed output is a traceback:
*git(b:master) $ gjslint --strict -r ./
Traceback (most recent call last):
File "/usr/local/bin/gjslint", line 8, in <module>
load_entry_point('closure-linter==2.3.5', 'console_scripts', 'gjslint')()
File "/Library/Python/2.7/site-packages/closure_linter/gjslint.py", line 244, in main
_PrintErrorRecords(records_iter_copy)
File "/Library/Python/2.7/site-packages/closure_linter/gjslint.py", line 194, in _PrintErrorRecords
for record in error_records:
File "/Library/Python/2.7/site-packages/closure_linter/gjslint.py", line 114, in _CheckPaths
results = _CheckPath(path)
File "/Library/Python/2.7/site-packages/closure_linter/gjslint.py", line 131, in _CheckPath
style_checker.Check(path)
File "/Library/Python/2.7/site-packages/closure_linter/checkerbase.py", line 179, in Check
self.CheckLines(filename, f, False)
File "/Library/Python/2.7/site-packages/closure_linter/checkerbase.py", line 225, in CheckLines
debug_tokens=FLAGS.debug_tokens)
File "/Library/Python/2.7/site-packages/closure_linter/checker.py", line 99, in _CheckTokens
self._lint_rules.Finalize(self._state_tracker, self._tokenizer.mode)
File "/Library/Python/2.7/site-packages/closure_linter/javascriptlintrules.py", line 499, in Finalize
self._CheckSortedRequiresProvides(state.GetFirstToken())
File "/Library/Python/2.7/site-packages/closure_linter/javascriptlintrules.py", line 511, in _CheckSortedRequiresProvides
provides_result = sorter.CheckProvides(token)
File "/Library/Python/2.7/site-packages/closure_linter/requireprovidesorter.py", line 65, in CheckProvides
provide_strings = self._GetRequireOrProvideTokenStrings(provide_tokens)
File "/Library/Python/2.7/site-packages/closure_linter/requireprovidesorter.py", line 196, in _GetRequireOrProvideTokenStrings
name = tokenutil.Search(token, Type.STRING_TEXT).string
AttributeError: 'NoneType' object has no attribute 'string'
What version of the product are you using? On what operating system?
Please provide any additional information below.
The file that causes the error is attached:
Original issue reported on code.google.com by [email protected]
on 22 Jun 2012 at 3:48
Attachments:
See Closure Lib 435: issue
http://code.google.com/p/closure-library/issues/detail?id=435
The linter should enforce these rules (or the design doc linked in that issue
should be changed to remove them).
Original issue reported on code.google.com by [email protected]
on 10 Mar 2012 at 7:01
What steps will reproduce the problem?
1. Use gjslint.
2.
3.
What is the expected output? What do you see instead?
A list of all todos, warnings, hacks, fixmes, notes, etc. watchwords
that we use throughout the code to highlight all the things
that need to be done or cleaned up.
What version of the product are you using? On what operating system?
2.3.5 on Mac OS X and Linux.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 22 Jun 2012 at 8:41
My JS is split up into several small files
- individually gjslint fails on about half of them
- if the files are combined (ready for minifying), it works OK
Run with - Windows Vista - Powershell
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
C:\Python27\Scripts\gjslint.exe --nobeep --nojsdoc --nodebug_indentation
file.js 2>&1
Error Message
Traceback (most recent call last):
File "C:\Python27\Scripts\gjslint-script.py", line 8, in <module>
load_entry_point('closure-linter==2.2.7', 'console_scripts', 'gjslint')()
File "build\bdist.win32\egg\closure_linter\gjslint.py", line 100, in main
File "build\bdist.win32\egg\closure_linter\checker.py", line 80, in Run
File "build\bdist.win32\egg\closure_linter\checkerbase.py", line 166, in Check
File "build\bdist.win32\egg\closure_linter\checkerbase.py", line 239, in CheckLines
File "build\bdist.win32\egg\closure_linter\javascriptlintrules.py", line 85, in CheckToken
File "build\bdist.win32\egg\closure_linter\ecmalintrules.py", line 412, in CheckToken
AttributeError: 'NoneType' object has no attribute 'string'
File that causes it
//
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---
// (C) 2008-2010 - Andrew Murphy All Rights Reserved
//
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---
//
--------------------------------------------------------------------------------
-------------------------------------
// WALK PHOTOS
//
--------------------------------------------------------------------------------
-------------------------------------
swc.pages.photos = function () {};
swc.pages.photos.prototype.set_photo_from_cgi_params = function()
{
// --------------------------------------------------------------------------------------------------
// used: /book_xx/walk_xx/walk_photos.shtml
// get the "photo number" cgi param, and call swc.photo
// photos[ number] refers to a list of photo objects inline html'ed into the photo page
// ---------------------------------------------------------------------------------------------------
var cgi_params = this.cgi_params(),
meta = this.meta_data() ,
photo_no = cgi_params.photo && cgi_params.photo > 0 ? cgi_params.photo : 0,
photo = photos[ photo_no ] ;
console.debug( ".. set photo from cgi params : " + photo_no + " : " + photo.title ) ;
document.title = photo.title + ' ' + document.title ;
this.meta_data( { 'description' : photo.title + ' ' + meta.description } ) ;
this.set_photo( photo ) ;
};
swc.pages.photos.prototype.set_photo = function( photo)
{
// called directly by clicking on a photo in the photo-list-widget on the photos page
// called from above function - using cgi params - from a photo on the thumbnails page
document.getElementById( "big_title" ).innerHTML = photo.title ;
document.getElementById( "big_author" ).innerHTML = photo.by + '<br>' + photo.date ;
document.getElementById( "big_photo" ).src = photo.src_big ;
document.getElementById( "big_url" ).href = photo.url ;
document.getElementById( "big_url" ).alt = photo.title ;
};
Original issue reported on code.google.com by [email protected]
on 2 Mar 2011 at 3:24
The attached patch allows the Closure Linter to be executed from a checkout in
two ways. One, is you can pass the directory location. Two, you use Python's -m
option. With either option you specify either 'lint' or 'fix' as the first
argument to Python to choose whether to run `gjslint` or `fixjsstyle`,
respectively.
So, specifying the directory to lint a file `foo.js` is `python closure-linter
lint foo.js`. Assuming you are in the checkout directory and want do use the -m
option, `python -m closure_linter lint foo.js`.
Original issue reported on code.google.com by bcannon
on 2 Oct 2010 at 11:57
Attachments:
What steps will reproduce the problem?
1. Run the linter on https://gist.github.com/2629373
What is the expected output?
No errors reported, because all of these methods are part of a prototype
object, so it should be clear what 'this' will refer to.
What do you see instead?
The error MISSING_JSDOC_TAG_THIS is reported for the first two 'someMethod's
but not for the third one.
What version of the product are you using?
2.3.5
I looked at the code a little bit, and I don't totally understand why this is
happening, but I noticed that there appears to be an unused local variable,
is_immediately_called:
http://code.google.com/searchframe#JjZqJjI_BoQ/trunk/closure_linter/javascriptli
ntrules.py&l=289
Original issue reported on code.google.com by [email protected]
on 7 May 2012 at 6:38
If one feeds fixjsstyle the following input, it will add 4 spaces on each run
(thus making multiple runs raise different results each time):
$> cat test1.js; fixjsstyle --strict test1.js
var x = function(
b) {
};
Fixed 1 errors in test1.js
$> cat test1.js; fixjsstyle --strict test1.js
var x = function(
b ) {
};
Fixed 1 errors in test1.js
$> cat test1.js; fixjsstyle --strict test1.js
var x = function(
b ) {
};
Fixed 1 errors in test1.js
BTW: Do you accept patches ?
Original issue reported on code.google.com by filip.noetzel
on 7 Feb 2011 at 11:11
What steps will reproduce the problem?
1. Enable lint error "unused_private_members" [--jslint_error
unused_private_members or --jslint_error all]
2. Name a constructor property with a trailing underscore [e.g., this.property_]
What is the expected output? What do you see instead?
Expected: E:0132: Unused private member: this.property_.
Actual: E:-002: Error parsing file at token "this.property_". Unable to check
the rest of file.
What version of the product are you using? On what operating system?
closure-linter==2.3.5
Please provide any additional information below.
The following file passes without error using --strict, but results in a parse
error when "--jslint_error unused_private_members" is enabled.
/** @constructor */
var Constructor1 = function() {
this.property1 = 'private_property';
};
var c1 = new Constructor1();
/** @constructor */
var Constructor2 = function() {
this.property_ = 'private_property';
};
var c2 = new Constructor2();
Original issue reported on code.google.com by [email protected]
on 24 Jun 2012 at 4:43
What steps will reproduce the problem?
1. Run fixjsstyle
What version of the product are you using? On what operating system?
Windows 7, Windows XP
Python 2.5.4
Please provide any additional information below.
C:\Users\Denya>fixjsstyle c:\Temp\finance_application_form.js
Traceback (most recent call last):
File "c:\Python25\Scripts\fixjsstyle-script.py", line 8, in <module>
load_entry_point('closure-linter==2.2.1', 'console_scripts', 'fixjsstyle')()
File "build\bdist.win32\egg\closure_linter\fixjsstyle.py", line 38, in main
File "build\bdist.win32\egg\closure_linter\common\simplefileflags.py", line 18
6, in GetFileList
File "build\bdist.win32\egg\closure_linter\common\simplefileflags.py", line 12
6, in GetAllSpecifiedFiles
File "build\bdist.win32\egg\closure_linter\common\simplefileflags.py", line 76
, in _GetUserSpecifiedFiles
TypeError: 'NoneType' object is unsubscriptable
Original issue reported on code.google.com by [email protected]
on 2 Sep 2010 at 12:13
1. easy_install
http://closure-linter.googlecode.com/files/closure_linter-2.3.1.tar.gz
2. run gjslint (windows7 64bit)
3. The following errors come out.
============================================
Traceback (most recent call last):
File "C:\Home\Env\Python27\Scripts\gjslint-script.py", line 8, in <module>
load_entry_point('closure-linter==2.3.1', 'console_scripts', 'gjslint')()
File "C:\Home\Env\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 318, in load_entry_point
File "C:\Home\Env\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 2221, in load_entry_point
File "C:\Home\Env\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 1954, in load
File "build\bdist.win-amd64\egg\closure_linter\gjslint.py", line 42, in <module>
File "build\bdist.win-amd64\egg\closure_linter\checker.py", line 25, in <module>
ImportError: cannot import name closurizednamespacesinfo
====================================================
Original issue reported on code.google.com by [email protected]
on 12 Sep 2011 at 3:56
What steps will reproduce the problem?
1. Install 2.3.6
2. git clone --depth 1 git://github.com/mozilla/pdf.js.git pdfjs
3. cd pdfjs
4. time( node make lint)
What is the expected output? What do you see instead?
I expect it to finish in less than a minute, instead it takes over 6 minutes
and sometimes dies.
What version of the product are you using? On what operating system?
2.3.6 on OSX
Please provide any additional information below.
On version 2.3.5 the command took 36 seconds.
Original issue reported on code.google.com by [email protected]
on 20 Jul 2012 at 12:54
Would it be reasonable in fixjsstyle to detect and avoid reformatting any
hashbangs found?
This of course only applies to javascript scripts run on the serverside like
with nodejs, but it would be nice to avoid having to hand edit the hash bang
lines that get messed up. This is what fixjsstyle does:
<pre>
-#!/usr/bin/env node
+# !/ usr / bin / env node;
</pre>
Original issue reported on code.google.com by [email protected]
on 6 Nov 2011 at 7:15
What steps will reproduce the problem?
1. wget
http://closure-library.googlecode.com/svn-history/r1562/trunk/closure/goog/event
s/browserevent.js
2. curl http://codereview.appspot.com/download/issue5150047_3002_4002.diff |
patch browserevent.js
3. gjslint --strict browserevent.js
What is the expected output? What do you see instead?
I expect a warning because of the lack of braces on the `if` statement starting
on line 256. I don't see that warning.
What version of the product are you using? On what operating system?
Using Closure Linter r14.
Original issue reported on code.google.com by [email protected]
on 7 Feb 2012 at 6:33
It would be great if the -x and -e args in fixjsstyle and gjslint accepted
wildcards or regexes.
This would allow me to:
gjslint -x *.min.js,*.*deps.js ...
It would also be great if these scripts were not so strict. i.e. I would like
to say:
fixjsstyle -x deps.js ...
instead of:
fixjsstyle -x dir1/dir2/deps.js ...
Tnx
Guido
Original issue reported on code.google.com by [email protected]
on 30 Jan 2011 at 12:40
What steps will reproduce the problem?
1. Write smth like this:
var MyClass = function (x) {
this.x = x;
};
2. Run it through gjslint
What is the expected output? What do you see instead?
I get 'Line 1, E:0001: Extra space after "function"', but I want to suppress
this check.
What version of the product are you using? On what operating system?
Closure Linter 2.3.4
OS: ubuntu linux and mac osx
Please provide any additional information below.
http://groups.google.com/group/closure-linter-discuss/browse_thread/thread/d9ec7
ffaf87ae8a4
Original issue reported on code.google.com by [email protected]
on 15 Dec 2011 at 6:49
Adding a copyright notice to the file that matches the one in other files.
(This would be helpful for the Chromium team so that this file passes
checklicenses.py: http://www.chromium.org/developers/adding-3rd-party-libraries)
Original issue reported on code.google.com by [email protected]
on 15 Feb 2012 at 11:39
Attachments:
What steps will reproduce the problem?
1. Install and run on OSX 10.6 with Python 3.1 (installed from ports)
2. # fixjsstyle somefile.js
Traceback (most recent call last):
File "/usr/local/bin/fixjsstyle", line 8, in <module>
load_entry_point('closure-linter==2.2.1', 'console_scripts', 'fixjsstyle')()
File "build/bdist.macosx-10.6-universal/egg/closure_linter/fixjsstyle.py", line 38, in main
File "build/bdist.macosx-10.6-universal/egg/closure_linter/common/simplefileflags.py", line 186, in GetFileList
File "build/bdist.macosx-10.6-universal/egg/closure_linter/common/simplefileflags.py", line 126, in GetAllSpecifiedFiles
File "build/bdist.macosx-10.6-universal/egg/closure_linter/common/simplefileflags.py", line 76, in _GetUserSpecifiedFiles
TypeError: 'NoneType' object is unsubscriptable
No problem running the gjslint binary.
Original issue reported on code.google.com by [email protected]
on 30 Aug 2010 at 10:07
What steps will reproduce the problem?
Just type
$ gjslint
on the terminal
What version of the product are you using? On what operating system?
gjslint 2.3.1 - Mac OS 10.7.1
Please provide any additional information below.
Traceback (most recent call last):
File "/usr/local/bin/gjslint", line 8, in <module>
load_entry_point('closure-linter==2.3.1', 'console_scripts', 'gjslint')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2221, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "build/bdist.macosx-10.7-intel/egg/closure_linter/gjslint.py", line 42, in <module>
File "build/bdist.macosx-10.7-intel/egg/closure_linter/checker.py", line 25, in <module>
Original issue reported on code.google.com by [email protected]
on 29 Aug 2011 at 11:26
What steps will reproduce the problem?
$> cat with_e4x.js
var f = <feed xmlns="http://www.w3.org/2005/Atom"/>;
$> fixjsstyle with_e4x.js
Fixed 5 errors in /Users/filip/workspace/codefairy2/with_e4x.js
$> cat with_e4x.js
var f = < feed xmlns = 'http://www.w3.org/2005/Atom'/ >;
What is the expected output?
var f = <feed xmlns="http://www.w3.org/2005/Atom"/>;
(file untouched)
What do you see instead?
var f = < feed xmlns = 'http://www.w3.org/2005/Atom'/ >;
(fixjsstyle thinks this these are operators and puts spaces around them)
What version of the product are you using? On what operating system?
2.2.4 / mac
Please provide any additional information below.
http://en.wikipedia.org/wiki/ECMAScript_for_XML
Original issue reported on code.google.com by filip.noetzel
on 12 Sep 2010 at 9:16
From initial report as part of issue 8:
$> cat with_var.js
var
a = 2,
b = 3;
console.log(a, b);
$> node with_var.js
2 3
$> fixjsstyle with_var.js
Fixed 1 errors in with_var.js
$ cat with_var.js
var;
a = 2,
b = 3;
console.log(a, b);
$> node with_var.js
with_var.js:1
var;
^
SyntaxError: Unexpected token ;
at Module._compile (node.js:457:37)
at Module._loadScriptSync (node.js:468:10)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:521:24)
at node.js:751:10
Original issue reported on code.google.com by [email protected]
on 16 Sep 2010 at 1:51
What steps will reproduce the problem?
1. Create a lint.js file:
var a = [];
for (var i = 0; i < 320; i++)
for (var j = 0; j < 240; j++)
a.push(0);
alert('bad indentation');
2. Lint this file, strict mode:
fixjsstyle --strict lint.js
What is the expected output? What do you see instead?
Line 6 should not be indented, though it is (2 spaces).
Please provide any additional information below.
The more you nest blocks without braces, the more the line with alert() is
indented.
Works only in strict mode (Normal mode does not enforce indentation).
Original issue reported on code.google.com by edo999
on 1 Sep 2011 at 3:56
What steps will reproduce the problem?
test.js
{{{
var a = new Scheme({default: 0})
}}}
gjslint test.js
Output:
{{{
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/closure_linter/checkerbase.py", line 201, in CheckLines
self.__metadata_pass.Process(token)
File "/usr/lib/python2.7/site-packages/closure_linter/ecmametadatapass.py", line 415, in Process
self._ProcessToken()
File "/usr/lib/python2.7/site-packages/closure_linter/ecmametadatapass.py", line 432, in _ProcessToken
context = (self._ProcessContext() or self._context)
File "/usr/lib/python2.7/site-packages/closure_linter/ecmametadatapass.py", line 369, in _ProcessContext
while self._context.parent.type != EcmaContext.SWITCH:
AttributeError: 'NoneType' object has no attribute 'type'
}}}
What version of the product are you using? On what operating system?
gjslint 2.2.7
Original issue reported on code.google.com by [email protected]
on 9 Mar 2011 at 8:37
I've been trying out the Closure Linter on some of my Rhino code, and
it works pretty well except for the fact that it doesn't realize that
"let" has the same syntax as "var", meaning it won't let me do
something like:
let variable1,
variable2,
variable 3;
It complains about incorrect indentation. I know the Closure tools
are designed specifically for ES3/ECMA 262, but would treating 'let'
as 'var' be a problem? It'd be awesome to be able to use the tool on
my console and server-side stuff as well.
Thanks!
Original issue reported on code.google.com by [email protected]
on 17 Dec 2010 at 11:02
function(a,b,c)
is not replaced by
function(a, b, c)
when using fixjsstyle --strict
Is this behaviour normal since all examples at
http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
use form function(a, b, c) ?
Original issue reported on code.google.com by [email protected]
on 15 Jun 2011 at 10:36
What steps will reproduce the problem?
1. Enter the following as lint_test.js:
-----------------------------------------------------
goog.provide('app.LintTest');
/**
* Small example for the problem with Google's JSLint
* @param {number} i An integer.
* @constructor
*/
app.LintTest = function(i) {
if (goog.isDef(i)) {
if (i < 5) {
alert('Less than 5');
}
else {
alert('Greater than or equal to 5.');
}
};
-----------------------------------------------------
2. Run the command 'gjslint lint_test.js'. You see an error which hints at the
mistake.
3. Run the command 'gjslint --strict lint_test.js'. You see the stack trace
listed below.
What is the expected output? What do you see instead?
I would expect to see an error message like you see without using the --strict
flag, or at the very least a controlled erroneous return. Instead, I see the
stack trace shown below.
[04:12:18 jyoung: /devel] $ gjslint --strict lint_test.js
Traceback (most recent call last):
File "/usr/local/bin/gjslint", line 8, in <module>
load_entry_point('closure-linter==2.2.1', 'console_scripts', 'gjslint')()
File "build/bdist.macosx-10.6-universal/egg/closure_linter/gjslint.py", line 100, in main
File "build/bdist.macosx-10.6-universal/egg/closure_linter/checker.py", line 80, in Run
File "build/bdist.macosx-10.6-universal/egg/closure_linter/checkerbase.py", line 155, in Check
File "build/bdist.macosx-10.6-universal/egg/closure_linter/checkerbase.py", line 228, in CheckLines
File "build/bdist.macosx-10.6-universal/egg/closure_linter/javascriptlintrules.py", line 82, in CheckToken
File "build/bdist.macosx-10.6-universal/egg/closure_linter/ecmalintrules.py", line 250, in CheckToken
File "build/bdist.macosx-10.6-universal/egg/closure_linter/indentation.py", line 206, in CheckToken
File "build/bdist.macosx-10.6-universal/egg/closure_linter/indentation.py", line 440, in _Add
AttributeError: 'NoneType' object has no attribute 'line_number'
What version of the product are you using? On what operating system?
I just checked out, built, and installed the tool from subversion today, so Rev
5 from svn. Part of the stack trace shows what looks like a version number:
load_entry_point('closure-linter==2.2.1'
Original issue reported on code.google.com by [email protected]
on 19 Sep 2010 at 8:23
What steps will reproduce the problem?
Run fixjsstyle in a file containing this code snippet:
if(true)
alert(true);
else
alert(false);
What is the expected output? What do you see instead?
Instead of the expected behavior I saw...
if(true)
alert(true);
else;
alert(false);
What version of the product are you using? On what operating system?
2.2.1, I think at this time it's the latest.
Please provide any additional information below.
The problem is a ";" after the else statement.
Original issue reported on code.google.com by [email protected]
on 2 Sep 2010 at 4:08
What steps will reproduce the problem?
Create a file with
a:{ 1; }
What is the expected output? What do you see instead?
ParseError
What version of the product are you using? On what operating system?
SVN head
Please provide any additional information below.
Support for javascript labels seem to be missing. It looks like the ":" create
an object context instead of a block context. A quick fix is adding
(self._last_code.IsOperator(':') and
self._last_code.metadata.context.type != EcmaContext.OBJECT_LITERAL) or
in ecmametadatapass.py line 346
Original issue reported on code.google.com by [email protected]
on 20 Apr 2012 at 7:37
What steps will reproduce the problem?
1. Save the following script to test.js:
"use strict";
var a = 1 + 2;
alert(a);
2. Run
fixjsstyle test.js [--strict]
3. The double quotes are miss-fixed. We get:
"'use strict';
var a = 1 + 2;
alert(a);
Instead of:
'use strict';
var a = 1 + 2;
alert(a);
What version of the product are you using?
closure_linter-2.3
This only happens when the file starts by a double quote. If there's anything
else before, such as a space or a breakline, the quotes are fixed correctly.
Original issue reported on code.google.com by edo999
on 24 May 2011 at 8:13
for example I want disable E0110 line too long.
gjslint --js myjs.js --disable E0110
Actually, 80 columns is very limited, for my own use, I'd like to set it to 100
or 120. Is there any way to set this variable.
Original issue reported on code.google.com by [email protected]
on 8 Nov 2010 at 12:24
It would be awesome if closure-linter was available for download from
http://pypi.python.org/ ..
Original issue reported on code.google.com by filip.noetzel
on 6 Feb 2011 at 7:22
What steps will reproduce the problem?
1. gjslint testcase.js
What is the expected output? What do you see instead?
I expect it to either report 0 errors or some # of errors. Instead it prints a
traceback.
What version of the product are you using? On what operating system?
Closure Linter 2.2.1, Mac OS X 10.6, Python 2.6.5
Original issue reported on code.google.com by [email protected]
on 1 Sep 2010 at 9:24
Attachments:
Nested ternary operators are causing a parsing error.
Example input:
a ? b ? 1 : 2 : 3;
Output (abbreviated):
Line 2, E:-002: Error parsing file at token ":". Unable to check the rest of
file.
Original issue reported on code.google.com by [email protected]
on 1 Sep 2010 at 11:06
What steps will reproduce the problem?
1. Run gjslint on a file with tab indentation
2. Watch it fail
3. Discover that gjslint has no way to disable E0005 and abandon ship
What is the expected output? What do you see instead?
Expected: an option to turn off E0005 and/or validate "proper" use of tabs.
What version of the product are you using? On what operating system?
closure-linter==2.3.5
Please provide any additional information below.
See discussion at
https://groups.google.com/forum/?fromgroups#!topic/closure-linter-discuss/yCvu-v
-hdi8
Original issue reported on code.google.com by [email protected]
on 1 Jun 2012 at 3:08
What steps will reproduce the problem?
1. Type in the following code in a file:
if (true)
alert('yes');
else;
alert('no');
2. run gjslint on the file
What is the expected output? What do you see instead?
Expected output is some complaint about the semi-colon after the else. (I think
I accidentally put them there every now and then because I'm so used to Python)
I would expect a warning at least on the `else;` part.
What version of the product are you using? On what operating system?
closure-linter 2.2.1
Please provide any additional information below.
When I accidentally left the semi-colon in there the Google Closure compiler
trips up on it.
Original issue reported on code.google.com by [email protected]
on 7 Nov 2010 at 6:40
Attachments:
What steps will reproduce the problem?
1. Use a non-breakable whitespace character in your code
What is the expected output? What do you see instead?
The expected output should be: a warning or it should simply work.
Instead I see:
Line 9, E:-002: Error parsing file at token "}". Unable to check the rest of
file.
The linenumber does not match the linenumber of the non-breaking whitespace
What version of the product are you using? On what operating system?
gjslint 2.3.5, Mac OSX 10.7.4
Additional Info:
The attached file has a non-breaking whitespace after the keyword "function".
Closure Linter does not break, if function block is empty.
Original issue reported on code.google.com by [email protected]
on 2 Jul 2012 at 2:42
Attachments:
What steps will reproduce the problem?
provide_order.js:
-----------------------------------------------
goog.provide('b');
goog.provide('a');
-----------------------------------------------
$ gjslint --strict provide_order.js
----- FILE : /devel/provide_order.js -----
Line 1, E:0141: goog.provide classes must be alphabetized. The correct code is:
goog.require('a');
goog.require('b');
Found 1 errors, including 0 new errors, in 1 files (0 files OK).
What is the expected output? What do you see instead?
Expected:
Line 1, E:0141: goog.provide classes must be alphabetized. The correct code is:
goog.provide('a');
goog.provide('b');
Actual: See above
What version of the product are you using? On what operating system?
Head on Mac OSX
Original issue reported on code.google.com by [email protected]
on 26 Apr 2011 at 11:49
What steps will reproduce the problem?
I have code that I want to be able to run without goog tools, thus I sniff for
goog at the top of the file.
--- INPUT file.js ----
if (typeof goog != 'undefined' && typeof goog.provide == 'function') {
goog.provide('MyLib.Base');
}
---------------------
gjslint complains:
"Line 1, E:0141: goog.provide classes must be alphabetized. The correct code
is:
goog.provide('MochiKit.Base');
goog.provide('function');"
Running fixjsstyle outputs this...
--- OUTPUT -----
if (typeof goog != 'undefined' && typeof goog.provide == 'MyLib.Base') {
goog.provide('function');
}
----------------------
What version of the product are you using? On what operating system?
Latest build (Jan 17), Python 2.5.4, Windows 7 64bit
// Fredrik Blomqvist
Original issue reported on code.google.com by [email protected]
on 20 Feb 2011 at 1:23
Fixes for closure-linter
Original issue reported on code.google.com by [email protected]
on 2 Sep 2010 at 4:14
Attachments:
What steps will reproduce the problem?
1. Use the following simple test case:
$ cat base.js
(function() {
})();
2. Run gjslint on it:
$ gjslint base.js
Internal error in /Users/tony/scratch/delta-2006.08.03/gjslint-example/base.js
Traceback (most recent call last):
File "build/bdist.macosx-10.6-universal/egg/closure_linter/checkerbase.py", line 190, in CheckLines
self.__metadata_pass.Process(token)
File "build/bdist.macosx-10.6-universal/egg/closure_linter/ecmametadatapass.py", line 395, in Process
self._ProcessToken()
File "build/bdist.macosx-10.6-universal/egg/closure_linter/ecmametadatapass.py", line 412, in _ProcessToken
context = (self._ProcessContext() or self._context)
File "build/bdist.macosx-10.6-universal/egg/closure_linter/ecmametadatapass.py", line 291, in _ProcessContext
if keyword_token.string in ('if', 'for', 'while'):
AttributeError: 'NoneType' object has no attribute 'string'
0 files checked, no errors found.
What is the expected output? What do you see instead?
I'd expect this to run successfully.
What version of the product are you using? On what operating system?
I installed closure_linter-latest.tar.gz this morning (Sept 1, 2010). I'm using
Mac OS X 10.6.3, with the native system Python (Python 2.6.1 (r261:67515, Dec
17 2009, 00:59:15)).
Original issue reported on code.google.com by [email protected]
on 1 Sep 2010 at 7:10
Would you please provide a silent version (with just simple error output, one
error per line) of closure-linter so that we can easily port to some other
program, like vim?
Currently I have to hack the code, delete some log output, so that it can be
integrated with quickfix of vim.
Original issue reported on code.google.com by yyfrankyy
on 19 Aug 2011 at 3:29
if (true)
alert('yes');
else;
alert('no');
Does not report that else shouldn't be followed immediately by a semi-colon.
This might be technically acceptable JavaScript (doesn't throw an error) but is
probably never intended.
Original issue reported on code.google.com by [email protected]
on 8 Nov 2010 at 5:23
A javascript file with a non-empty anonymous block will fail to be parsed by
the closure-linter v2.2.7.
The following snippet demonstrates the problem:
var foo = function() {
{
var bar = 42;
};
};
The closure-linter v2.2.7 will report the following error:
Line 5, E:-002: Error parsing file at token "}". Unable to check the rest of
file.
What I expect would rather be a warning/error that anonymous blocks should be
avoided to prevent the illusion of block-scope, whereas javascript only
provides function-scope.
This bug makes it impossible to run the closure-linter on a large file that
contains one or more anonymous blocks.
Original issue reported on code.google.com by [email protected]
on 12 Mar 2011 at 9:53
What steps will reproduce the problem?
1. Create any line of source code where the ^ operator is the last character.
2. Run fixjsstyle.
3. Note the line has been improperly terminated with a semi-colon.
What is the expected output? What do you see instead?
No semicolons when line ends with valid ^ operator. Instead the tool introduces
syntax errors.
What version of the product are you using? On what operating system?
Mac OSX, latest SVN checkout as of filing this bug.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 May 2012 at 7:34
The closure-linter does not allow for compound @suppress types. For example:
@suppress {accessControls|visibility}
However, these compound types are supported in closure-compiler.
This change checks each @suppress sub-type (by splitting on '|') against
SUPPRESS_TYPES.
http://codereview.appspot.com/4645042
Original issue reported on code.google.com by [email protected]
on 16 Jun 2011 at 9:18
What steps will reproduce the problem?
1. Don't install setuptools.
2. In closure-linter, python setup.py install
3. Observe that gjslint and fixjsstyle are not installed.
It would be great if closure-linter's setup.py had a scripts= argument, which
would install the scripts even if setuptools is not available.
Original issue reported on code.google.com by [email protected]
on 1 Sep 2010 at 1:09
Sorry, but this is all about the edge cases:
$> cat breaking2.js
(function() {
console.log(1);
})
();
$> node breaking2.js
1
$> ./bin/fixjsstyle breaking2.js
Fixed 1 errors in breaking2.js
$> cat breaking2.js
(function() {
console.log(1);
});
();
$> node breaking2.js
breaking2.js:5
();
^
SyntaxError: Unexpected token )
at Module._compile (node.js:658:37)
at Module._loadScriptSync (node.js:669:10)
at Module.loadSync (node.js:538:12)
at Object.runMain (node.js:722:24)
at Array.0 (node.js:745:12)
at EventEmitter._tickCallback (node.js:55:22)
at node.js:757:9
Original issue reported on code.google.com by filip.noetzel
on 24 Sep 2010 at 3:26
I'm trying to use linter to check my server side code and its breaking my bash
instructions.
I.e. I have a line like this:
#!node
And its turning it into:
# !node;
I know server side JS is still an edge case so if no one wants to do this I'll
have a look but I don't know python so would rather not.
Thanks
Guido
Original issue reported on code.google.com by [email protected]
on 30 Jan 2011 at 12:57
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.