This program was written as part of the Celtra programming contest. The report and more about how the program works can be found on my website.
Prerequisites:
- Python 3.0
- python setuptools
Clone the repository:
git clone https://github.com/matematik7/CSSQC.git
Install:
sudo ./setup.py install
To run the program type:
cssqc -i input_file(s)
cssqc -h
Display full argument options help.
cssqc -c config_file
Specify config file. All options in config file override the options specified in cssqc/defaults.cfg. The format is the same as cssqc/defaults.cfg.
cssqc -v
More verbose warning description and some file statistics.
cssqc --bangFormat off
All rules can also be overriden on command line using two dashes and rule name.
All rules can be deactivated using off option. Rules can be activated using on, unless otherwise specified.
Format of spaces around bang(!) before important. Options are 'before', 'after', 'both' and 'none'.
Default is 'before'.
Closing braces on its own line, for oneliners preceeded by space. Options are 'exact' and 'atleast'. 'atleast' allows any number of spaces.
Default is 'atleast'.
Format of spaces around colon(:) in properties. Options are 'before', 'after', 'both', 'none' and 'align'. You can specify multiple options separated by comma.
Default is 'after,align'.
Warn on duplicated properties in ruleset.
Default is 'on'.
File must have newline at the end.
Default is 'on'.
Force use of single(') or double(") quotes. Options are 'single' and 'double'.
Default is 'off'.
Group properties. Grouping rules are defined in cssqc/group/*.dat. OPT must be valid grouping name.
Default is 'off'.
Format hex colors. Options are:
- 'long' (must be 6 characters long)
- 'short' (must be 3 characters when possible)
- 'lowercase', 'uppercase' and
- 'validate' (must be 3 or 6 characters long).
Multiple options can be specified, separated by comma.
Default is 'validate,lowercase'
Ensure proper indentation. OPT can be integer number of spaces or 'tab'. Allows right align for properties with same suffix.
Default is '4'.
Force everything lowercase except hex colors, strings and comments.
Default is 'on'.
Allow only nested rules up to 'OPT'-th level. OPT must be integer.
Default is 4.
Do not allow specifing colors with keywords.
Default is 'on'.
Do not allow descendant selectors.
Default is 'off'.
Do not allow rulesets with empty blocks.
Default is 'on'.
Do not allow IDs in selectors.
Default is 'off'.
Do not allow "js-" prefixes in selectors.
Default is 'on'.
Do not allow leading zeros with decimals (e.g. 0.3px).
Default is 'off'.
Do not allow multiple class selectors (e.g. .class1.class2).
Default is 'off'.
Do not allow overqualifying. Options are 'class', 'id' and 'both'. Class means no tag with class, but only if there are not 2 different rules for different tags with same class. ID means nothing additional when using ID qualifier.
Default is 'id'.
Do not allow redundant body selectors (e.g. body {} is ok, but body div {} is not).
Default is 'off'.
Do not allow redundant child selectors (e.g. ul.class li is ok, but ul li {} is not).
Default is 'off'.
Do not allow tag with class in selectors (e.g. div.class).
Default is 'off'.
Do not allow trailing zeros with decimals (e.g. .30px).
Default is 'on'.
Do not allow underscores in class, id and mixin names.
Default is 'on'.
Do not allow universal selectors on their own (e.g. div * {} is not allowed, but *.class {} is ok).
Default is 'on'.
Do not allow percentage after 0 value.
Default is 'off'.
Do not allow units after 0 value.
Default is 'on'.
Force single line for rulesets with only one property.
Default is 'on'.
Opening braces on the same line as last selector preceeded by one space, followed by newline (or space for oneliners). Options are 'exact' and 'atleast'. 'atleast' allows any number of spaces.
Default is 'atleast'.
Force ordered properties. Orders are defined in 'cssqc/order/*.dat'. OPT must be valid order name.
Default is 'off'.
Validate property names.
Default is 'on'.
Allow selector depth up to 'OPT'. OPT must be integer.
Default is '4'.
Do not allow property over multiple lines.
Default is 'on'.
Do not allow selector over multiple lines.
Default is 'on'.
Only allow one property on each line.
Default is 'on'.
Only allow one selector on each line.
Default is 'off'.
Commas in lists should be followed by space.
Default is 'on'.
Last property in ruleset must be semicolon terminated.
Default is 'on'.