qa-control 0.6.2 → 0.6.3
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 +52 -34
- package/bin/qa-control-run.js +2 -0
- package/bin/qa-control.js +4 -0
- 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
|
|
|
@@ -55,7 +55,7 @@ module.exports = function(qaControl){
|
|
|
55
55
|
},
|
|
56
56
|
files:{
|
|
57
57
|
'README.md':{ mandatory:true },
|
|
58
|
-
'LEEME.md':{
|
|
58
|
+
'LEEME.md':{ presentIf: function(pj) { return !(pj['qa-control'] && pj['qa-control'].multilang === 'no'); } },
|
|
59
59
|
'.gitignore':{
|
|
60
60
|
mandatory:true,
|
|
61
61
|
mandatoryLines:['local-*','*-local.*']
|
|
@@ -131,7 +131,7 @@ module.exports = function(qaControl){
|
|
|
131
131
|
check: function(packageJson){
|
|
132
132
|
return !packageJson['qa-control']['test-appveyor'];
|
|
133
133
|
},
|
|
134
|
-
md:'[](https://github.com/xxx/yyy/actions/workflows/build-and-test.yml)',
|
|
135
135
|
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-linux.png',
|
|
136
136
|
docDescription: 'linux/build'
|
|
137
137
|
},
|
|
@@ -139,7 +139,7 @@ module.exports = function(qaControl){
|
|
|
139
139
|
check: function(packageJson){
|
|
140
140
|
return !!packageJson['qa-control']['test-appveyor'];
|
|
141
141
|
},
|
|
142
|
-
md:'[](https://github.com/xxx/yyy/actions/workflows/build-and-test.yml)',
|
|
143
143
|
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-linux.png',
|
|
144
144
|
hideInManual: true,
|
|
145
145
|
},
|
|
@@ -167,7 +167,7 @@ module.exports = function(qaControl){
|
|
|
167
167
|
},
|
|
168
168
|
'qa-control':{
|
|
169
169
|
mandatory:false,
|
|
170
|
-
md:'[](https://github.com/xxx/yyy/actions/workflows/qa-control.yml)',
|
|
171
171
|
docDescription: ''
|
|
172
172
|
},
|
|
173
173
|
'outdated-deps':{
|
|
@@ -227,6 +227,49 @@ module.exports = function(qaControl){
|
|
|
227
227
|
}],
|
|
228
228
|
shouldAbort:true
|
|
229
229
|
},
|
|
230
|
+
repository_in_package_json:{
|
|
231
|
+
checks:[{
|
|
232
|
+
warnings:function(info) {
|
|
233
|
+
var warns = [];
|
|
234
|
+
if(!('repository' in info.packageJson)) {
|
|
235
|
+
warns.push({warning:'lack_of_repository_section_in_package_json', scoring:{mandatories:1}});
|
|
236
|
+
} else {
|
|
237
|
+
if(! qaControl.getRepositoryUrl(info.packageJson).match(/^([-a-zA-Z0-9_.]+\/[-a-zA-Z0-9_.]+)$/)){
|
|
238
|
+
return [{warning:'repository_name_not_found', scoring:{mandatories:1}}];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return warns;
|
|
242
|
+
}
|
|
243
|
+
}],
|
|
244
|
+
shouldAbort:true
|
|
245
|
+
},
|
|
246
|
+
invalid_repository_in_package_json:{
|
|
247
|
+
checks:[{
|
|
248
|
+
warnings:function(info) {
|
|
249
|
+
var warns = [];
|
|
250
|
+
var repoParts = qaControl.getRepositoryUrl(info.packageJson).split('/');
|
|
251
|
+
var projName = repoParts[repoParts.length-1];
|
|
252
|
+
if(projName !== info.packageJson.name) {
|
|
253
|
+
return [{warning:'invalid_repository_section_in_package_json', scoring:{repository:1}}];
|
|
254
|
+
}
|
|
255
|
+
return warns;
|
|
256
|
+
}
|
|
257
|
+
}]
|
|
258
|
+
},
|
|
259
|
+
github_repository:{
|
|
260
|
+
eclipsers:['lack_of_repository_section_in_package_json', 'repository_name_not_found', 'invalid_repository_section_in_package_json'],
|
|
261
|
+
checks:[{
|
|
262
|
+
warnings:function(info) {
|
|
263
|
+
if(!qaControl.repoIs) { return []; }
|
|
264
|
+
var actual = qaControl.getRepositoryUrl(info.packageJson).replace(/\.git$/, '');
|
|
265
|
+
var expected = qaControl.repoIs.replace(/\.git$/, '');
|
|
266
|
+
if(actual !== expected) {
|
|
267
|
+
return [{warning:'repository_does_not_match_1', params:[expected], scoring:{repository:1}}];
|
|
268
|
+
}
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
271
|
+
}]
|
|
272
|
+
},
|
|
230
273
|
mandatory_files:{
|
|
231
274
|
checks:[{
|
|
232
275
|
warnings:function(info) {
|
|
@@ -249,22 +292,6 @@ module.exports = function(qaControl){
|
|
|
249
292
|
}],
|
|
250
293
|
shouldAbort:true
|
|
251
294
|
},
|
|
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
|
|
267
|
-
},
|
|
268
295
|
valid_values_for_qa_control_keys:{
|
|
269
296
|
checks:[{
|
|
270
297
|
warnings:function(info){
|
|
@@ -315,6 +342,7 @@ module.exports = function(qaControl){
|
|
|
315
342
|
no_multilang_section_in_1:{
|
|
316
343
|
checks:[{
|
|
317
344
|
warnings:function(info){
|
|
345
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].multilang === 'no') { return []; }
|
|
318
346
|
if(!info.files[qaControl.mainDoc()].content.match(/<!--multilang v[0-9]+\s+(.+)(-->)/)) {
|
|
319
347
|
return [{
|
|
320
348
|
warning:'no_multilang_section_in_1',
|
|
@@ -326,23 +354,11 @@ module.exports = function(qaControl){
|
|
|
326
354
|
}
|
|
327
355
|
}]
|
|
328
356
|
},
|
|
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
357
|
cucardas:{
|
|
343
358
|
eclipsers:['invalid_repository_section_in_package_json', 'lack_of_repository_section_in_package_json'],
|
|
344
359
|
checks:[{
|
|
345
360
|
warnings:function(info){
|
|
361
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].multilang === 'no') { return []; }
|
|
346
362
|
var warns=[];
|
|
347
363
|
var readme=info.files[qaControl.mainDoc()].content;
|
|
348
364
|
if(readme.indexOf(qaControl.cucaMarker) === -1) {
|
|
@@ -430,6 +446,7 @@ module.exports = function(qaControl){
|
|
|
430
446
|
first_lines:{
|
|
431
447
|
checks:[{
|
|
432
448
|
warnings:function(info) {
|
|
449
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].profile === 'minimum') { return []; }
|
|
433
450
|
var warns=[];
|
|
434
451
|
var qaControlSection=info.packageJson['qa-control'];
|
|
435
452
|
var whichRunIn=qaControlSection['run-in'];
|
|
@@ -516,6 +533,7 @@ module.exports = function(qaControl){
|
|
|
516
533
|
multilang:{
|
|
517
534
|
checks:[{
|
|
518
535
|
warnings:function(info) {
|
|
536
|
+
if(info.packageJson['qa-control'] && info.packageJson['qa-control'].multilang === 'no') { return []; }
|
|
519
537
|
var warns = [];
|
|
520
538
|
var defReadme = qaControl.mainDoc();
|
|
521
539
|
var content = info.files[defReadme].content;
|
|
@@ -635,7 +653,7 @@ module.exports = function(qaControl){
|
|
|
635
653
|
checks:[{
|
|
636
654
|
warnings:function(info) {
|
|
637
655
|
var warns = [];
|
|
638
|
-
var nonRecomended = ['best-promise', '
|
|
656
|
+
var nonRecomended = ['best-promise', 'jslint', 'lodash', 'promise-plus'];
|
|
639
657
|
var dependencies = info.packageJson.dependencies;
|
|
640
658
|
var devDependencies = info.packageJson.devDependencies;
|
|
641
659
|
if(dependencies) {
|
package/bin/qa-control-run.js
CHANGED
|
@@ -17,6 +17,7 @@ program
|
|
|
17
17
|
.option('-L, --list-langs', 'List available languages')
|
|
18
18
|
.option('-c, --cucardas', 'Always generate cucardas.log')
|
|
19
19
|
.option('-i, --init', 'Initialize project with qa-control specs')
|
|
20
|
+
.option('--repo-is <owner_or_org/repo>', 'Expected GitHub repository (owner_or_org/repo)')
|
|
20
21
|
.parse(process.argv);
|
|
21
22
|
|
|
22
23
|
var opts = program.opts();
|
|
@@ -33,6 +34,7 @@ params.verbose = opts.verbose;
|
|
|
33
34
|
params.listLangs = opts.listLangs;
|
|
34
35
|
params.lang = opts.lang;
|
|
35
36
|
params.cucardas = opts.cucardas;
|
|
37
|
+
params.repoIs = opts.repoIs || process.env.GITHUB_REPOSITORY || null;
|
|
36
38
|
// console.log(opts); process.exit(0);
|
|
37
39
|
// console.log(params); process.exit(0);
|
|
38
40
|
|
package/bin/qa-control.js
CHANGED
|
@@ -25,6 +25,7 @@ function forEach(obj, func) {
|
|
|
25
25
|
|
|
26
26
|
qaControl.msgs={
|
|
27
27
|
en:{
|
|
28
|
+
lack_of_mandatory_section_1: 'lack of mandatory section "$1" in qa-control section of package.json',
|
|
28
29
|
repository_name_not_found: 'packageJson.repository must be in format /{[-a-zA-Z0-9_.]+}\/[-a-zA-Z0-9_.]+/'
|
|
29
30
|
},
|
|
30
31
|
es:{
|
|
@@ -52,6 +53,7 @@ qaControl.msgs={
|
|
|
52
53
|
readme_multilang_not_sincronized_with_file_1: 'README.md no esta sincronizado con "$1" para multilang',
|
|
53
54
|
lack_of_repository_section_in_package_json: 'Falta la sección "repository" en package.json',
|
|
54
55
|
invalid_repository_section_in_package_json: 'La sección "repository" en package.json es inválida',
|
|
56
|
+
repository_does_not_match_1: 'el repositorio no coincide con el esperado "$1"',
|
|
55
57
|
invalid_dependency_version_number_format_in_dep_1: 'El formato del numero de version es incorrecto en "$1"',
|
|
56
58
|
wrong_use_strict_spelling_in_file_1: '"use strict" está mal escrito en "$1"',
|
|
57
59
|
lack_of_files_section_in_package_json: 'Falta la sección "files" en package.json',
|
|
@@ -175,6 +177,7 @@ qaControl.nodeVerInTravisRE = /[678]/;
|
|
|
175
177
|
|
|
176
178
|
qaControl.verbose = false;
|
|
177
179
|
qaControl.cucardas_always = false;
|
|
180
|
+
qaControl.repoIs = null;
|
|
178
181
|
qaControl.definition = require("./definition/definition.js")(qaControl);
|
|
179
182
|
|
|
180
183
|
qaControl.lang = process.env.qa_control_lang || 'en';
|
|
@@ -377,6 +380,7 @@ qaControl.stringizeWarnings = function stringizeWarnings(warns, lang) {
|
|
|
377
380
|
qaControl.controlProject=function controlProject(projectDir, opts){
|
|
378
381
|
qaControl.verbose = opts && opts.verbose;
|
|
379
382
|
qaControl.cucardas_always = opts && opts.cucardas;
|
|
383
|
+
qaControl.repoIs = (opts && opts.repoIs) || null;
|
|
380
384
|
return Promise.resolve().then(function(){
|
|
381
385
|
return qaControl.loadProject(projectDir);
|
|
382
386
|
}).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.3",
|
|
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",
|