Add CSS coding convention checker

Bug #764084 reported by Adi Roiban
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pocket-lint
Fix Released
High
Adi Roiban

Bug Description

Like we have PEP8 it would be nice to have a similar coding convention checker for CSS.

cssutils only checks for valid property names and values and does not report formating / coding conventions changes.

I have wrote a CSS coding convention checker to be use for my projects and I was thinking that maybe you would like to have something like this in pocket-lint.

It is based on the CSS coding conventions described on this page : http://www.phpied.com/css-coding-conventions/

It includes support for both ways of opening CSS blocks:

selector,
selector2
{
    property: value;
}

selector,
selector2 {
    property: value;
}

-----

There are still things that could be improved but for the moment it works for me as it is.

If there is interest and feedback I could improve the code so that it can be useful for others.

-----

I will attach my branch to this bug.

Cheers

Related branches

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

Thanks for linking to a branch.

I too pondered a CSS style checker. I am not happy with CSSUtils. It is slow and emphasises historic CSS instead of preparing CSS for modern usage. The formatter that gdp uses is more rigorous with indentation:
 selector (
    property-name: value;
    }
But I neglected to move that formatter when I extracted the checking and formatting rules to pocketlint (See bug 601736).

I have proposed the branch for merging.

Changed in pocket-lint:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Adi Roiban (adiroiban)
Adi Roiban (adiroiban)
description: updated
Revision history for this message
Adi Roiban (adiroiban) wrote :

I don't know what code is referred in bug #601736.

The current parser is not as nice as it should be.
I would like to have it implemented using pyparsing or a similar module.

But if at least the tests are ok, I could refactor the code more easily.

Cheers

Curtis Hovey (sinzui)
Changed in pocket-lint:
milestone: none → 0.5.15
Curtis Hovey (sinzui)
Changed in pocket-lint:
status: Triaged → Fix Committed
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.