qa-control 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/definition/definition.js +92 -62
- package/bin/qa-control-run.js +4 -0
- package/bin/qa-control.js +26 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ Quality assurance tool for node/npm projects
|
|
|
6
6
|

|
|
7
7
|
[](https://npmjs.org/package/qa-control)
|
|
8
8
|
[](https://npmjs.org/package/qa-control)
|
|
9
|
-
[](https://github.com/codenautas/qa-control/actions/workflows/build-and-test.yml)
|
|
10
10
|
[](https://coveralls.io/r/codenautas/qa-control)
|
|
11
11
|
[](https://snyk.io/test/github/codenautas/qa-control)
|
|
12
|
-
[](https://github.com/codenautas/qa-control/actions/workflows/qa-control.yml)
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -17,6 +17,15 @@ var fs = require('fs-promise');
|
|
|
17
17
|
var Path = require('path');
|
|
18
18
|
var yaml = require('js-yaml');
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param {PackageJson} packageJson
|
|
23
|
+
* @returns boolean
|
|
24
|
+
*/
|
|
25
|
+
function testAppVeyor(packageJson){
|
|
26
|
+
return !!packageJson?.['qa-control']?.["test-appveyor"];
|
|
27
|
+
}
|
|
28
|
+
|
|
20
29
|
/** @param {string} realRegex */
|
|
21
30
|
function softRegExp(realRegex) {
|
|
22
31
|
var re=realRegex.replace(/\\/g, '\\\\')
|
|
@@ -55,30 +64,28 @@ module.exports = function(qaControl){
|
|
|
55
64
|
},
|
|
56
65
|
files:{
|
|
57
66
|
'README.md':{ mandatory:true },
|
|
58
|
-
'LEEME.md':{
|
|
67
|
+
'LEEME.md':{ presentIf: function(pj) { return !(pj['qa-control'] && pj['qa-control'].multilang === 'no'); } },
|
|
59
68
|
'.gitignore':{
|
|
60
69
|
mandatory:true,
|
|
61
70
|
mandatoryLines:['local-*','*-local.*']
|
|
62
71
|
},
|
|
63
72
|
'LICENSE':{ mandatory:true },
|
|
64
73
|
'appveyor.yml':{
|
|
65
|
-
presentIf:
|
|
66
|
-
return !!packageJson['qa-control']["test-appveyor"];
|
|
67
|
-
}
|
|
74
|
+
presentIf: testAppVeyor
|
|
68
75
|
},
|
|
69
76
|
'.eslintrc.yml':{ presentIf: function(pj) { return pj['qa-control'] && pj['qa-control'].profile !== 'minimum'; } }
|
|
70
77
|
},
|
|
71
78
|
cucardas:{
|
|
72
79
|
'proof-of-concept':{
|
|
73
80
|
check: function(packageJson){
|
|
74
|
-
return packageJson['qa-control']
|
|
81
|
+
return packageJson?.['qa-control']?.purpose==='proof-of-concept';
|
|
75
82
|
},
|
|
76
83
|
md:'',
|
|
77
84
|
imgExample:'https://img.shields.io/badge/stability-designing-red.svg'
|
|
78
85
|
},
|
|
79
86
|
designing:{
|
|
80
87
|
check: function(packageJson){
|
|
81
|
-
return semver.satisfies(packageJson.version,'0.0.x') && !packageJson['qa-control']
|
|
88
|
+
return semver.satisfies(packageJson.version,'0.0.x') && !packageJson?.['qa-control']?.purpose;
|
|
82
89
|
},
|
|
83
90
|
md:'',
|
|
84
91
|
imgExample:'https://img.shields.io/badge/stability-designing-red.svg',
|
|
@@ -88,7 +95,7 @@ module.exports = function(qaControl){
|
|
|
88
95
|
check: function(packageJson){
|
|
89
96
|
return semver.satisfies(packageJson.version,'0.x.x') &&
|
|
90
97
|
!semver.satisfies(packageJson.version,'0.0.x') &&
|
|
91
|
-
!packageJson['qa-control'].purpose;
|
|
98
|
+
!packageJson?.['qa-control'].purpose;
|
|
92
99
|
},
|
|
93
100
|
md:'',
|
|
94
101
|
imgExample:'https://img.shields.io/badge/stability-extending-orange.svg',
|
|
@@ -96,21 +103,21 @@ module.exports = function(qaControl){
|
|
|
96
103
|
},
|
|
97
104
|
training:{
|
|
98
105
|
check: function(packageJson){
|
|
99
|
-
return packageJson['qa-control']
|
|
106
|
+
return packageJson?.['qa-control']?.purpose==='training';
|
|
100
107
|
},
|
|
101
108
|
md:'',
|
|
102
109
|
imgExample:'https://img.shields.io/badge/stability-training-ffa0c0.svg'
|
|
103
110
|
},
|
|
104
111
|
example:{
|
|
105
112
|
check: function(packageJson){
|
|
106
|
-
return packageJson['qa-control']
|
|
113
|
+
return packageJson?.['qa-control']?.purpose==='example';
|
|
107
114
|
},
|
|
108
115
|
md:'',
|
|
109
116
|
imgExample:'https://img.shields.io/badge/stability-example-a0a0f0.svg'
|
|
110
117
|
},
|
|
111
118
|
stable:{
|
|
112
119
|
check: function(packageJson){
|
|
113
|
-
return semver.satisfies(packageJson.version,'>=1.0.0') && !packageJson['qa-control']
|
|
120
|
+
return semver.satisfies(packageJson.version,'>=1.0.0') && !packageJson?.['qa-control']?.purpose;
|
|
114
121
|
},
|
|
115
122
|
md:'',
|
|
116
123
|
imgExample:'https://img.shields.io/badge/stability-stable-blue.svg'
|
|
@@ -128,32 +135,26 @@ module.exports = function(qaControl){
|
|
|
128
135
|
docDescription: ''
|
|
129
136
|
},
|
|
130
137
|
build:{
|
|
131
|
-
check:
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
md:'[](https://github.com/xxx/yyy/actions/workflows/node.js.yml)',
|
|
138
|
+
check: (...args) => !testAppVeyor(...args),
|
|
139
|
+
md:'[](https://github.com/xxx/yyy/actions/workflows/build-and-test.yml)',
|
|
135
140
|
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-linux.png',
|
|
136
141
|
docDescription: 'linux/build'
|
|
137
142
|
},
|
|
138
143
|
linux:{
|
|
139
|
-
check:
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
md:'[](https://github.com/xxx/yyy/actions/workflows/node.js.yml)',
|
|
144
|
+
check: testAppVeyor,
|
|
145
|
+
md:'[](https://github.com/xxx/yyy/actions/workflows/build-and-test.yml)',
|
|
143
146
|
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-linux.png',
|
|
144
147
|
hideInManual: true,
|
|
145
148
|
},
|
|
146
149
|
windows:{
|
|
147
|
-
check:
|
|
148
|
-
return !!packageJson['qa-control']['test-appveyor'];
|
|
149
|
-
},
|
|
150
|
+
check: testAppVeyor,
|
|
150
151
|
md:'[](https://ci.appveyor.com/project/xxx/yyy)',
|
|
151
152
|
imgExample:'https://ci.appveyor.com/api/projects/status/github/codenautas/pg-promise-strict?svg=true',
|
|
152
153
|
docDescription: 'casos especiales'
|
|
153
154
|
},
|
|
154
155
|
coverage:{
|
|
155
156
|
check: function(packageJson){
|
|
156
|
-
return packageJson['qa-control']
|
|
157
|
+
return packageJson?.['qa-control']?.coverage;
|
|
157
158
|
},
|
|
158
159
|
md:'[](https://coveralls.io/r/xxx/yyy)',
|
|
159
160
|
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/coverage.png',
|
|
@@ -167,7 +168,7 @@ module.exports = function(qaControl){
|
|
|
167
168
|
},
|
|
168
169
|
'qa-control':{
|
|
169
170
|
mandatory:false,
|
|
170
|
-
md:'[](https://github.com/xxx/yyy/actions/workflows/qa-control.yml)',
|
|
171
172
|
docDescription: ''
|
|
172
173
|
},
|
|
173
174
|
'outdated-deps':{
|
|
@@ -206,26 +207,69 @@ module.exports = function(qaControl){
|
|
|
206
207
|
exist_package_json:{
|
|
207
208
|
checks:[{
|
|
208
209
|
warnings:function(info){
|
|
209
|
-
if(!info.files['package.json']){
|
|
210
|
+
if(!info.files?.['package.json']){
|
|
210
211
|
return [{warning:'no_package_json', scoring:{fatal:1}}];
|
|
211
212
|
}
|
|
212
213
|
return [];
|
|
213
214
|
}
|
|
214
215
|
}],
|
|
215
|
-
|
|
216
|
+
couldBail:true
|
|
216
217
|
},
|
|
217
218
|
qa_control_section_in_package_json:{
|
|
218
219
|
checks:[{
|
|
219
220
|
warnings:function(info){
|
|
220
|
-
if(!info.packageJson['qa-control']){
|
|
221
|
-
return [{warning:info.files['package.json']
|
|
221
|
+
if(!info.packageJson?.['qa-control']){
|
|
222
|
+
return [{warning:info.files?.['package.json']?.content?.match(/codenautas/)?
|
|
222
223
|
'no_qa_control_section_in_codenautas_project':
|
|
223
224
|
'no_qa_control_section_in_package_json', scoring:{fatal:1}}];
|
|
224
225
|
}
|
|
225
226
|
return [];
|
|
226
227
|
}
|
|
227
228
|
}],
|
|
228
|
-
|
|
229
|
+
mustAbort:true
|
|
230
|
+
},
|
|
231
|
+
repository_in_package_json:{
|
|
232
|
+
checks:[{
|
|
233
|
+
warnings:function(info) {
|
|
234
|
+
var warns = [];
|
|
235
|
+
if(!('repository' in info.packageJson)) {
|
|
236
|
+
warns.push({warning:'lack_of_repository_section_in_package_json', scoring:{mandatories:1}});
|
|
237
|
+
} else {
|
|
238
|
+
if(! qaControl.getRepositoryUrl(info.packageJson).match(/^([-a-zA-Z0-9_.]+\/[-a-zA-Z0-9_.]+)$/)){
|
|
239
|
+
return [{warning:'repository_name_not_found', scoring:{mandatories:1}}];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return warns;
|
|
243
|
+
}
|
|
244
|
+
}],
|
|
245
|
+
couldBail:true
|
|
246
|
+
},
|
|
247
|
+
invalid_repository_in_package_json:{
|
|
248
|
+
checks:[{
|
|
249
|
+
warnings:function(info) {
|
|
250
|
+
var warns = [];
|
|
251
|
+
var repoParts = qaControl.getRepositoryUrl(info.packageJson).split('/');
|
|
252
|
+
var projName = repoParts[repoParts.length-1];
|
|
253
|
+
if(projName !== info.packageJson.name) {
|
|
254
|
+
return [{warning:'invalid_repository_section_in_package_json', scoring:{repository:1}}];
|
|
255
|
+
}
|
|
256
|
+
return warns;
|
|
257
|
+
}
|
|
258
|
+
}]
|
|
259
|
+
},
|
|
260
|
+
github_repository:{
|
|
261
|
+
eclipsers:['lack_of_repository_section_in_package_json', 'repository_name_not_found', 'invalid_repository_section_in_package_json'],
|
|
262
|
+
checks:[{
|
|
263
|
+
warnings:function(info) {
|
|
264
|
+
if(!qaControl.repoIs) { return []; }
|
|
265
|
+
var actual = qaControl.getRepositoryUrl(info.packageJson).replace(/\.git$/, '');
|
|
266
|
+
var expected = qaControl.repoIs.replace(/\.git$/, '');
|
|
267
|
+
if(actual !== expected) {
|
|
268
|
+
return [{warning:'repository_does_not_match_1', params:[expected], scoring:{repository:1}}];
|
|
269
|
+
}
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
}]
|
|
229
273
|
},
|
|
230
274
|
mandatory_files:{
|
|
231
275
|
checks:[{
|
|
@@ -247,29 +291,13 @@ module.exports = function(qaControl){
|
|
|
247
291
|
return warns;
|
|
248
292
|
}
|
|
249
293
|
}],
|
|
250
|
-
|
|
251
|
-
},
|
|
252
|
-
repository_in_package_json:{
|
|
253
|
-
checks:[{
|
|
254
|
-
warnings:function(info) {
|
|
255
|
-
var warns = [];
|
|
256
|
-
if(!('repository' in info.packageJson)) {
|
|
257
|
-
warns.push({warning:'lack_of_repository_section_in_package_json', scoring:{mandatories:1}});
|
|
258
|
-
} else {
|
|
259
|
-
if(! qaControl.getRepositoryUrl(info.packageJson).match(/^([-a-zA-Z0-9_.]+\/[-a-zA-Z0-9_.]+)$/)){
|
|
260
|
-
return [{warning:'repository_name_not_found', scoring:{mandatories:1}}];
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return warns;
|
|
264
|
-
}
|
|
265
|
-
}],
|
|
266
|
-
shouldAbort:true
|
|
294
|
+
couldBail:true
|
|
267
295
|
},
|
|
268
296
|
valid_values_for_qa_control_keys:{
|
|
269
297
|
checks:[{
|
|
270
298
|
warnings:function(info){
|
|
271
299
|
var warns=[];
|
|
272
|
-
var qaControlSection=info.packageJson['qa-control'];
|
|
300
|
+
var qaControlSection=info.packageJson?.['qa-control'] ?? {};
|
|
273
301
|
var sections=qaControl.definition.sections;
|
|
274
302
|
/*jshint forin: false */
|
|
275
303
|
for(var sectionName in sections){
|
|
@@ -287,7 +315,18 @@ module.exports = function(qaControl){
|
|
|
287
315
|
return warns;
|
|
288
316
|
}
|
|
289
317
|
}],
|
|
290
|
-
|
|
318
|
+
couldBail:true
|
|
319
|
+
},
|
|
320
|
+
cant_continue:{
|
|
321
|
+
checks:[{
|
|
322
|
+
warnings: function(info){
|
|
323
|
+
if (info.warningCount) {
|
|
324
|
+
return [{warning:'cant_continue', scoring:{fatal:1}}];
|
|
325
|
+
}
|
|
326
|
+
return []
|
|
327
|
+
}
|
|
328
|
+
}],
|
|
329
|
+
mustAbort:true
|
|
291
330
|
},
|
|
292
331
|
mandatory_lines:{
|
|
293
332
|
checks:[{
|
|
@@ -315,6 +354,7 @@ module.exports = function(qaControl){
|
|
|
315
354
|
no_multilang_section_in_1:{
|
|
316
355
|
checks:[{
|
|
317
356
|
warnings:function(info){
|
|
357
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].multilang === 'no') { return []; }
|
|
318
358
|
if(!info.files[qaControl.mainDoc()].content.match(/<!--multilang v[0-9]+\s+(.+)(-->)/)) {
|
|
319
359
|
return [{
|
|
320
360
|
warning:'no_multilang_section_in_1',
|
|
@@ -326,23 +366,11 @@ module.exports = function(qaControl){
|
|
|
326
366
|
}
|
|
327
367
|
}]
|
|
328
368
|
},
|
|
329
|
-
invalid_repository_in_package_json:{
|
|
330
|
-
checks:[{
|
|
331
|
-
warnings:function(info) {
|
|
332
|
-
var warns = [];
|
|
333
|
-
var repoParts = qaControl.getRepositoryUrl(info.packageJson).split('/');
|
|
334
|
-
var projName = repoParts[repoParts.length-1];
|
|
335
|
-
if(projName !== info.packageJson.name) {
|
|
336
|
-
return [{warning:'invalid_repository_section_in_package_json', scoring:{repository:1}}];
|
|
337
|
-
}
|
|
338
|
-
return warns;
|
|
339
|
-
}
|
|
340
|
-
}]
|
|
341
|
-
},
|
|
342
369
|
cucardas:{
|
|
343
370
|
eclipsers:['invalid_repository_section_in_package_json', 'lack_of_repository_section_in_package_json'],
|
|
344
371
|
checks:[{
|
|
345
372
|
warnings:function(info){
|
|
373
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].multilang === 'no') { return []; }
|
|
346
374
|
var warns=[];
|
|
347
375
|
var readme=info.files[qaControl.mainDoc()].content;
|
|
348
376
|
if(readme.indexOf(qaControl.cucaMarker) === -1) {
|
|
@@ -430,8 +458,9 @@ module.exports = function(qaControl){
|
|
|
430
458
|
first_lines:{
|
|
431
459
|
checks:[{
|
|
432
460
|
warnings:function(info) {
|
|
461
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].profile === 'minimum') { return []; }
|
|
433
462
|
var warns=[];
|
|
434
|
-
var qaControlSection=info.packageJson['qa-control'];
|
|
463
|
+
var qaControlSection=info.packageJson['qa-control'] ?? {};
|
|
435
464
|
var whichRunIn=qaControlSection['run-in'];
|
|
436
465
|
var whichType=qaControlSection.type;
|
|
437
466
|
var firstLines=qaControl.definition.firstLines[whichRunIn][whichType];
|
|
@@ -516,6 +545,7 @@ module.exports = function(qaControl){
|
|
|
516
545
|
multilang:{
|
|
517
546
|
checks:[{
|
|
518
547
|
warnings:function(info) {
|
|
548
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].multilang === 'no') { return []; }
|
|
519
549
|
var warns = [];
|
|
520
550
|
var defReadme = qaControl.mainDoc();
|
|
521
551
|
var content = info.files[defReadme].content;
|
|
@@ -635,7 +665,7 @@ module.exports = function(qaControl){
|
|
|
635
665
|
checks:[{
|
|
636
666
|
warnings:function(info) {
|
|
637
667
|
var warns = [];
|
|
638
|
-
var nonRecomended = ['best-promise', '
|
|
668
|
+
var nonRecomended = ['best-promise', 'jslint', 'lodash', 'promise-plus'];
|
|
639
669
|
var dependencies = info.packageJson.dependencies;
|
|
640
670
|
var devDependencies = info.packageJson.devDependencies;
|
|
641
671
|
if(dependencies) {
|
package/bin/qa-control-run.js
CHANGED
|
@@ -16,7 +16,9 @@ program
|
|
|
16
16
|
.option('-v, --verbose', 'Show progress information')
|
|
17
17
|
.option('-L, --list-langs', 'List available languages')
|
|
18
18
|
.option('-c, --cucardas', 'Always generate cucardas.log')
|
|
19
|
+
.option('-b, --bail', 'Stop at first blocking issue')
|
|
19
20
|
.option('-i, --init', 'Initialize project with qa-control specs')
|
|
21
|
+
.option('--repo-is <owner_or_org/repo>', 'Expected GitHub repository (owner_or_org/repo)')
|
|
20
22
|
.parse(process.argv);
|
|
21
23
|
|
|
22
24
|
var opts = program.opts();
|
|
@@ -33,6 +35,8 @@ params.verbose = opts.verbose;
|
|
|
33
35
|
params.listLangs = opts.listLangs;
|
|
34
36
|
params.lang = opts.lang;
|
|
35
37
|
params.cucardas = opts.cucardas;
|
|
38
|
+
params.bail = opts.bail || false;
|
|
39
|
+
params.repoIs = opts.repoIs || process.env.GITHUB_REPOSITORY || null;
|
|
36
40
|
// console.log(opts); process.exit(0);
|
|
37
41
|
// console.log(params); process.exit(0);
|
|
38
42
|
|
package/bin/qa-control.js
CHANGED
|
@@ -25,7 +25,9 @@ function forEach(obj, func) {
|
|
|
25
25
|
|
|
26
26
|
qaControl.msgs={
|
|
27
27
|
en:{
|
|
28
|
-
|
|
28
|
+
lack_of_mandatory_section_1: 'lack of mandatory section "$1" in qa-control section of package.json',
|
|
29
|
+
repository_name_not_found: 'packageJson.repository must be in format /{[-a-zA-Z0-9_.]+}\/[-a-zA-Z0-9_.]+/',
|
|
30
|
+
bailing_could_be_more: '--bail(ing)! There could be more issues'
|
|
29
31
|
},
|
|
30
32
|
es:{
|
|
31
33
|
deprecated_version: 'la version es demasiado vieja',
|
|
@@ -52,12 +54,14 @@ qaControl.msgs={
|
|
|
52
54
|
readme_multilang_not_sincronized_with_file_1: 'README.md no esta sincronizado con "$1" para multilang',
|
|
53
55
|
lack_of_repository_section_in_package_json: 'Falta la sección "repository" en package.json',
|
|
54
56
|
invalid_repository_section_in_package_json: 'La sección "repository" en package.json es inválida',
|
|
57
|
+
repository_does_not_match_1: 'el repositorio no coincide con el esperado "$1"',
|
|
55
58
|
invalid_dependency_version_number_format_in_dep_1: 'El formato del numero de version es incorrecto en "$1"',
|
|
56
59
|
wrong_use_strict_spelling_in_file_1: '"use strict" está mal escrito en "$1"',
|
|
57
60
|
lack_of_files_section_in_package_json: 'Falta la sección "files" en package.json',
|
|
58
61
|
invalid_files_section_in_package_json: 'La sección "files" en package.json es inválida',
|
|
59
62
|
incorrect_ecmascript_versions_in_package_json: 'Las versiones de ECMAScript utilizadas en package.json son incorrectas',
|
|
60
|
-
non_recomended_dependency_1_in_package_json: 'Dependencia no recomendada "$1" en package.json'
|
|
63
|
+
non_recomended_dependency_1_in_package_json: 'Dependencia no recomendada "$1" en package.json',
|
|
64
|
+
bailing_could_be_more: '¡Qué --bail(e)! Podrían haber más problemas, correr de nuevo después de corregir estos'
|
|
61
65
|
}
|
|
62
66
|
};
|
|
63
67
|
|
|
@@ -101,7 +105,7 @@ qaControl.startsWith = function startsWith(bufTest, bufStart) {
|
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
qaControl.getRepositoryUrl = function getRepositoryUrl(packageJson) {
|
|
104
|
-
var repo = packageJson.repository
|
|
108
|
+
var repo = packageJson.repository?.url ?? packageJson.repository ?? "";
|
|
105
109
|
var ghRepo = /(https:\/\/github\.com\/)/.exec(repo);
|
|
106
110
|
if(ghRepo) { repo = repo.replace(ghRepo[1], ''); }
|
|
107
111
|
return repo;
|
|
@@ -175,6 +179,7 @@ qaControl.nodeVerInTravisRE = /[678]/;
|
|
|
175
179
|
|
|
176
180
|
qaControl.verbose = false;
|
|
177
181
|
qaControl.cucardas_always = false;
|
|
182
|
+
qaControl.repoIs = null;
|
|
178
183
|
qaControl.definition = require("./definition/definition.js")(qaControl);
|
|
179
184
|
|
|
180
185
|
qaControl.lang = process.env.qa_control_lang || 'en';
|
|
@@ -310,6 +315,12 @@ qaControl.loadProject = function loadProject(projectDir) {
|
|
|
310
315
|
});
|
|
311
316
|
};
|
|
312
317
|
|
|
318
|
+
/**
|
|
319
|
+
*
|
|
320
|
+
* @param {ProjectInfo} info
|
|
321
|
+
* @param {QAOptions} opts
|
|
322
|
+
* @returns
|
|
323
|
+
*/
|
|
313
324
|
qaControl.controlInfo=function controlInfo(info, opts){
|
|
314
325
|
var resultWarnings=[];
|
|
315
326
|
var existingWarnings={};
|
|
@@ -318,6 +329,8 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
318
329
|
var silenced = ((info.packageJson || {})['qa-control'] || {}).silenced || [];
|
|
319
330
|
var cadenaDePromesas = Promise.resolve(/** @type {Warning[]} */ ([]));
|
|
320
331
|
info.scoring = opts && opts.scoring;
|
|
332
|
+
var bailed = false;
|
|
333
|
+
info.warningCount = 0;
|
|
321
334
|
forEach(rules, function(rule, ruleName) {
|
|
322
335
|
rule.checks.forEach(function(checkInfo){
|
|
323
336
|
cadenaDePromesas = cadenaDePromesas.then(function() {
|
|
@@ -333,8 +346,15 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
333
346
|
activeWarnings.forEach(function(warning){
|
|
334
347
|
existingWarnings[warning.warning]=true;
|
|
335
348
|
});
|
|
336
|
-
if(rule.
|
|
349
|
+
if(rule.couldBail && opts && opts.bail) {
|
|
350
|
+
bailed = true;
|
|
351
|
+
throw new Error("ruleIsAborting");
|
|
352
|
+
}
|
|
353
|
+
if(rule.mustAbort) {
|
|
354
|
+
throw new Error("ruleIsAborting");
|
|
355
|
+
}
|
|
337
356
|
}
|
|
357
|
+
info.warningCount += warningsOfThisRule.length;
|
|
338
358
|
return resultWarnings;
|
|
339
359
|
});
|
|
340
360
|
});
|
|
@@ -344,6 +364,7 @@ qaControl.controlInfo=function controlInfo(info, opts){
|
|
|
344
364
|
throw err;
|
|
345
365
|
}
|
|
346
366
|
}).then(function(){
|
|
367
|
+
if(bailed) { resultWarnings.push({warning:'bailing_could_be_more'}); }
|
|
347
368
|
return resultWarnings;
|
|
348
369
|
});
|
|
349
370
|
return cadenaDePromesas;
|
|
@@ -377,6 +398,7 @@ qaControl.stringizeWarnings = function stringizeWarnings(warns, lang) {
|
|
|
377
398
|
qaControl.controlProject=function controlProject(projectDir, opts){
|
|
378
399
|
qaControl.verbose = opts && opts.verbose;
|
|
379
400
|
qaControl.cucardas_always = opts && opts.cucardas;
|
|
401
|
+
qaControl.repoIs = (opts && opts.repoIs) || null;
|
|
380
402
|
return Promise.resolve().then(function(){
|
|
381
403
|
return qaControl.loadProject(projectDir);
|
|
382
404
|
}).then(function(info){
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qa-control",
|
|
3
3
|
"description": "QA control of things that nobody controls",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.4",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/qa-control",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"node": ">= 10"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"test": "mocha --reporter spec
|
|
52
|
+
"test": "mocha --reporter spec --check-leaks test/",
|
|
53
53
|
"test-nc": "mocha --reporter spec --bail --check-leaks --no-colors test/",
|
|
54
54
|
"test-ci": "nyc --reporter=lcov mocha --reporter spec --check-leaks test/",
|
|
55
55
|
"test-cov": "nyc mocha --reporter dot --check-leaks test/",
|
|
56
|
-
"start": "node
|
|
56
|
+
"start": "node ./bin/qa-control-run.js",
|
|
57
57
|
"report": "nyc report",
|
|
58
58
|
"qac": "node bin/qa-control-run.js . -v",
|
|
59
59
|
"typecheck": "tsc",
|