mathiasrw / closure-linter

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

gjslint doesn't handle goog.provide(''); #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 yesudeep@google.com on 22 Jun 2012 at 3:48

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by vagra...@google.com on 29 Jul 2013 at 8:29

GoogleCodeExporter commented 9 years ago

Original comment by vagra...@google.com on 29 Oct 2013 at 3:25