google / closure-linter

Automatically exported from code.google.com/p/closure-linter
Apache License 2.0
109 stars 37 forks source link

fixjsstyle should ignore lines beginning with # #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 guido.tapia@gmail.com on 30 Jan 2011 at 12:57

GoogleCodeExporter commented 9 years ago
Here's how to reproduce this:

$ cat shebang.js 
#!/usr/bin/env node

var x = 1;

$> gjslint shebang.js 
----- FILE  :  shebang.js -----
Line 1, E:0002: Missing space before "!"
Line 1, E:0002: Missing space after "/"
Line 1, E:0002: Missing space before "/"
Line 1, E:0002: Missing space after "/"
Line 1, E:0002: Missing space before "/"
Line 1, E:0002: Missing space after "/"
Line 1, E:0010: (New error) Missing semicolon at end of line
Found 7 errors, including 1 new errors, in 1 files (0 files OK).

Some of the errors reported by GJsLint may be auto-fixable using the script
fixjsstyle. Please double check any changes it makes and report any bugs. The
script can be run by executing:

fixjsstyle shebang.js

$> fixjsstyle shebang.js
Fixed 7 errors in shebang.js

$> cat shebang.js 
# !/ usr / bin / env node;

var x = 1;

Original comment by filip.noetzel on 6 Feb 2011 at 6:44

GoogleCodeExporter commented 9 years ago
Attached a patch fixing this issue (including fixjsstyle_test.py testcase).

Original comment by filip.noetzel on 20 Feb 2011 at 5:06

Attachments:

GoogleCodeExporter commented 9 years ago
Hi filip, I'm trying to test this but had no luck so far, I've applied your 
patch, run setup.py install but I don't think its running your new 
checker_base.py (none of my test output is printed to screen).

I'm running the fixjsstyle directly from the closure_linter directory and can 
verify that I am running the correct fixjsstyle.py (as some test debug gets 
printed).  I can also verify the patch was successful as I can see the code in 
the checker_base.py.

Am I missing something here.  Is it possible that its using the installed 
version of checker_base even though I'm running the fixjsstyle.py file with 
absolute dir?  Apologies for my python ignorance.

Original comment by guido.tapia@gmail.com on 21 Feb 2011 at 12:28

GoogleCodeExporter commented 9 years ago
Sorted it out, I can confirm that this fixed my problem.  Have NOT given code 
review though.

Thanks Filip

Original comment by guido.tapia@gmail.com on 21 Feb 2011 at 3:45

GoogleCodeExporter commented 9 years ago
Any patches for the closure_linter-2.3.10? I tried to shoehorn it in myself but 
too much has changes in the code and I'm getting a "AttributeError: 'NoneType' 
object has no attribute 'line_number'"-error.

Several of our Node javascript-files begins with "#!/usr/bin/env node" and now 
we have to exclude the whole files to get pass our Jenkins-buildsteps.

Original comment by tryc...@gmail.com on 17 May 2013 at 8:14

GoogleCodeExporter commented 9 years ago
Just tried to port patch of filip.noetzel (in comment #2 above) to 2.3.11

Please update if it works for you.

Original comment by vagra...@google.com on 30 Jul 2013 at 11:52

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by vagra...@google.com on 30 Jul 2013 at 11:54

GoogleCodeExporter commented 9 years ago
Issue 37 has been merged into this issue.

Original comment by vagra...@google.com on 31 Jul 2013 at 3:26

GoogleCodeExporter commented 9 years ago
Is there a reason that this patch has not been merged?

Original comment by orweiz...@gmail.com on 24 Jun 2014 at 3:24