empty css statements crashes linter

Bug #890101 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pocket-lint
Fix Released
High
Curtis Hovey

Bug Description

Our lint check crashes on lib/lp/app/javascript/activator/assets/skins/sam/activator-skin.css: it contains an empty CSS class.

This may be a bug in pocketlint as well; I don't know whether a CSS class is allowed to be empty. There may be some trivial workaround.

Revision history for this message
Curtis Hovey (sinzui) wrote :

This defect is in pocketlint/contrib/cssccc.py and can be fixed today.

Traceback (most recent call last):
  File "/usr/bin/pocketlint", line 6, in <module>
    sys.exit(main(sys.argv))
  File "/usr/lib/pymodules/python2.7/pocketlint/formatcheck.py", line 617, in main
    return check_sources(sources, reporter)
  File "/usr/lib/pymodules/python2.7/pocketlint/formatcheck.py", line 601, in check_sources
    checker.check()
  File "/usr/lib/pymodules/python2.7/pocketlint/formatcheck.py", line 250, in check
    CSSChecker(self.file_path, self.text, self._reporter).check()
  File "/usr/lib/pymodules/python2.7/pocketlint/formatcheck.py", line 424, in check
    self.check_css_coding_conventions()
  File "/usr/lib/pymodules/python2.7/pocketlint/formatcheck.py", line 449, in check_css_coding_conventions
    CSSCodingConventionChecker(self.text, logger=self.message).check()
  File "/usr/lib/pymodules/python2.7/pocketlint/contrib/cssccc.py", line 294, in check
    rule.check()
  File "/usr/lib/pymodules/python2.7/pocketlint/contrib/cssccc.py", line 128, in check
    self.checkDeclarations()
  File "/usr/lib/pymodules/python2.7/pocketlint/contrib/cssccc.py", line 170, in checkDeclarations
    start_line = self.declarations.getStartLine()
  File "/usr/lib/pymodules/python2.7/pocketlint/contrib/cssccc.py", line 255, in getStartLine
    character = text[index]
IndexError: string index out of range

affects: launchpad → pocket-lint
Changed in pocket-lint:
importance: Low → High
tags: removed: trivial ui
Changed in pocket-lint:
milestone: none → future
Curtis Hovey (sinzui)
Changed in pocket-lint:
assignee: Huw Wilkins (huwshimi) → Curtis Hovey (sinzui)
Curtis Hovey (sinzui)
Changed in pocket-lint:
status: Triaged → Fix Committed
summary: - activator-skin crashes linter
+ empty css statements crashes linter
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Thanks Curtis! The hack I used to work around the exception was to add a blank to the "text" string that's being indexed. But you may find that wasteful.

Revision history for this message
Curtis Hovey (sinzui) wrote :

An empty selector is legitimate CSS. a crash that prevent the linter from saying that the style is OK is bad.

Curtis Hovey (sinzui)
Changed in pocket-lint:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.