@@ -68,18 +68,29 @@ function cli(api){
68
68
69
69
70
70
/**
71
- * Filters out files using the exclude-files command line option.
71
+ * Filters out files using the exclude-list command line option.
72
72
* @param files {Array} the list of files to check for exclusions
73
73
* @param options {Object} the CLI options
74
74
* @return {Array } A list of files
75
75
*/
76
76
function filterFiles ( files , options ) {
77
- var excludeFiles = options [ "exclude-files" ] ,
77
+ var excludeList = options [ "exclude-list" ] ,
78
+ excludeFiles = [ ] ,
78
79
filesToLint = files ;
79
80
80
81
81
- if ( excludeFiles ) {
82
- excludeFiles . split ( "," ) . forEach ( function ( value ) {
82
+ if ( excludeList ) {
83
+ // Build up the exclude list, expanding any directory exclusions that were passed in
84
+ excludeList . split ( "," ) . forEach ( function ( value ) {
85
+ if ( api . isDirectory ( value ) ) {
86
+ excludeFiles = excludeFiles . concat ( api . getFiles ( value ) ) ;
87
+ } else {
88
+ excludeFiles . push ( value ) ;
89
+ }
90
+ } ) ;
91
+
92
+ // Remove the excluded files from the list of files to lint
93
+ excludeFiles . forEach ( function ( value ) {
83
94
if ( filesToLint . indexOf ( value ) > - 1 ) {
84
95
filesToLint . splice ( filesToLint . indexOf ( value ) , 1 ) ;
85
96
}
@@ -149,15 +160,15 @@ function cli(api){
149
160
"\nUsage: csslint-rhino.js [options]* [file|dir]*" ,
150
161
" " ,
151
162
"Global Options" ,
152
- " --help Displays this information." ,
153
- " --format=<format> Indicate which format to use for output." ,
154
- " --list-rules Outputs all of the rules available." ,
155
- " --quiet Only output when errors are present." ,
156
- " --errors=<rule[,rule]+> Indicate which rules to include as errors." ,
157
- " --warnings=<rule[,rule]+> Indicate which rules to include as warnings." ,
158
- " --ignore=<rule, [,rule]+> Indicate which rules to ignore completely." ,
159
- " --exclude-files =<file, [,file]+> Indicate which files to exclude from being linted." ,
160
- " --version Outputs the current version number."
163
+ " --help Displays this information." ,
164
+ " --format=<format> Indicate which format to use for output." ,
165
+ " --list-rules Outputs all of the rules available." ,
166
+ " --quiet Only output when errors are present." ,
167
+ " --errors=<rule[,rule]+> Indicate which rules to include as errors." ,
168
+ " --warnings=<rule[,rule]+> Indicate which rules to include as warnings." ,
169
+ " --ignore=<rule[,rule]+> Indicate which rules to ignore completely." ,
170
+ " --exclude-list =<file|dir [,file|dir ]+> Indicate which files/directories to exclude from being linted." ,
171
+ " --version Outputs the current version number."
161
172
] . join ( "\n" ) + "\n" ) ;
162
173
}
163
174
0 commit comments