@@ -26,9 +26,8 @@ function cli(api){
2626 * @param options {Object} The CLI options.
2727 * @return {Object } A ruleset object.
2828 */
29- function gatherRules ( options ) {
30- var ruleset ,
31- warnings = options . rules || options . warnings ,
29+ function gatherRules ( options , ruleset ) {
30+ var warnings = options . rules || options . warnings ,
3231 errors = options . errors ;
3332
3433 if ( warnings ) {
@@ -44,6 +43,24 @@ function cli(api){
4443 ruleset [ value ] = 2 ;
4544 } ) ;
4645 }
46+
47+ return ruleset ;
48+ }
49+
50+ /**
51+ * Filters out rules using the ignore command line option.
52+ * @param options {Object} the CLI options
53+ * @return {Object } A ruleset object.
54+ */
55+ function filterRules ( options ) {
56+ var ignore = options . ignore ,
57+ ruleset = CSSLint . getRuleset ( ) ;
58+
59+ if ( ignore ) {
60+ ignore . split ( "," ) . forEach ( function ( value ) {
61+ delete ruleset [ value ] ;
62+ } ) ;
63+ }
4764
4865 return ruleset ;
4966 }
@@ -68,7 +85,8 @@ function cli(api){
6885 */
6986 function processFile ( relativeFilePath , options ) {
7087 var input = api . readFile ( relativeFilePath ) ,
71- result = CSSLint . verify ( input , gatherRules ( options ) ) ,
88+ ruleset = filterRules ( options ) ,
89+ result = CSSLint . verify ( input , gatherRules ( options , ruleset ) ) ,
7290 formatter = CSSLint . getFormatter ( options . format || "text" ) ,
7391 messages = result . messages || [ ] ,
7492 output ,
@@ -113,6 +131,7 @@ function cli(api){
113131 " --quiet Only output when errors are present." ,
114132 " --errors=<rule[,rule]+> Indicate which rules to include as errors." ,
115133 " --warnings=<rule[,rule]+> Indicate which rules to include as warnings." ,
134+ " --ignore=<rule,[,rule]+> Indicate which rules to ignore completely." ,
116135 " --version Outputs the current version number."
117136 ] . join ( "\n" ) + "\n" ) ;
118137 }
0 commit comments