@@ -34,6 +34,9 @@ function usage() {
34
34
35
35
"--lang " =>
36
36
"[Optional] Language file to use for the result (en-us by default). " ,
37
+
38
+ "--max-errors " =>
39
+ "[Optional] Defines how many errors are still allowed for a pass (0 by default) " ,
37
40
38
41
"--level " =>
39
42
"[Optional] Specifies the output level (info, warning, error). For console report only. " ,
@@ -68,6 +71,7 @@ function usage() {
68
71
$ options ['lang ' ] = 'en-us ' ;
69
72
$ options ['quiet ' ] = false ;
70
73
$ options ['time ' ] = false ;
74
+ $ options ['max-errors ' ] = 0 ;
71
75
$ lineCountFile = null ;
72
76
73
77
// loop through user input
@@ -98,10 +102,10 @@ function usage() {
98
102
$ options ['lang ' ] = $ _SERVER ['argv ' ][$ i ];
99
103
break ;
100
104
101
- case "--level " :
102
- $ i ++;
103
- $ options ['level ' ] = $ _SERVER ['argv ' ][$ i ];
104
- break ;
105
+ case "--level " :
106
+ $ i ++;
107
+ $ options ['level ' ] = $ _SERVER ['argv ' ][$ i ];
108
+ break ;
105
109
106
110
case "--config " :
107
111
$ i ++;
@@ -167,6 +171,10 @@ function usage() {
167
171
echo "\nPlease specify a source directory/file using --src option. \n\n" ;
168
172
usage ();
169
173
}
174
+ if (!$ options ['max-errors ' ]) {
175
+ echo "\nPlease specify a number when using --max-errors option. \n\n" ;
176
+ usage ();
177
+ }
170
178
171
179
if (!empty ($ options ['linecount ' ])) {
172
180
$ lineCountFile = "ncss.xml " ;
@@ -222,8 +230,5 @@ function usage() {
222
230
223
231
}
224
232
225
-
226
-
227
-
228
- $ exitCode = ($ errorCounts [ERROR ] > 0 ) ? 1 : 0 ;
233
+ $ exitCode = ($ errorCounts [ERROR ] > $ options ['max-errors ' ]) ? 1 : 0 ;
229
234
exit ($ exitCode );
0 commit comments