qa-control 0.5.0 → 0.6.0
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 +1 -1
- package/bin/{0.3.0 → definition}/definition.js +680 -764
- package/bin/{0.3.0 → definition}/first-lines-both.txt +25 -25
- package/bin/definition/first-lines-client.txt +3 -0
- package/bin/{0.3.0 → definition}/first-lines-server-app.txt +2 -2
- package/bin/{0.3.0 → definition}/first-lines-server-cmd-tool.txt +2 -2
- package/bin/{0.3.0 → definition}/first-lines-server.txt +3 -3
- package/bin/definition/first-lines-web.txt +3 -0
- package/bin/qa-control.js +15 -42
- package/bin/qac-init.js +0 -18
- package/package.json +1 -1
- package/bin/0.0.1/definition.js +0 -556
- package/bin/0.0.1/first-lines-both.txt +0 -28
- package/bin/0.0.1/first-lines-client.txt +0 -6
- package/bin/0.0.1/first-lines-server-app.txt +0 -6
- package/bin/0.0.1/first-lines-server.txt +0 -6
- package/bin/0.0.2/definition.js +0 -577
- package/bin/0.0.2/first-lines-both.txt +0 -28
- package/bin/0.0.2/first-lines-client.txt +0 -6
- package/bin/0.0.2/first-lines-server-app.txt +0 -6
- package/bin/0.0.2/first-lines-server.txt +0 -6
- package/bin/0.1.3/definition.js +0 -653
- package/bin/0.1.3/first-lines-both.txt +0 -28
- package/bin/0.1.3/first-lines-client.txt +0 -6
- package/bin/0.1.3/first-lines-server-app.txt +0 -7
- package/bin/0.1.3/first-lines-server.txt +0 -7
- package/bin/0.1.4/definition.js +0 -706
- package/bin/0.1.4/first-lines-both.txt +0 -28
- package/bin/0.1.4/first-lines-client.txt +0 -6
- package/bin/0.1.4/first-lines-server-app.txt +0 -7
- package/bin/0.1.4/first-lines-server.txt +0 -7
- package/bin/0.2.0/definition.js +0 -771
- package/bin/0.2.0/first-lines-both.txt +0 -27
- package/bin/0.2.0/first-lines-client.txt +0 -5
- package/bin/0.2.0/first-lines-server-app.txt +0 -6
- package/bin/0.2.0/first-lines-server-cmd-tool.txt +0 -6
- package/bin/0.2.0/first-lines-server.txt +0 -6
- package/bin/0.3.0/first-lines-client.txt +0 -3
- package/bin/0.3.0/first-lines-web.txt +0 -3
package/bin/0.0.2/definition.js
DELETED
|
@@ -1,577 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var stripBom = require("strip-bom-string");
|
|
4
|
-
var semver = require("semver");
|
|
5
|
-
var jsh = require('jshint');
|
|
6
|
-
var multilang = require('multilang');
|
|
7
|
-
var fs = require('fs-promise');
|
|
8
|
-
var Path = require('path');
|
|
9
|
-
|
|
10
|
-
module.exports = function(qaControl){
|
|
11
|
-
return {
|
|
12
|
-
fileNameMainDoc: 'LEEME.md',
|
|
13
|
-
sections: { // podria llamarse 'json-sections'...
|
|
14
|
-
'run-in': {
|
|
15
|
-
mandatory: true,
|
|
16
|
-
values: {
|
|
17
|
-
server:{},
|
|
18
|
-
both:{},
|
|
19
|
-
client:{}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
type: {
|
|
23
|
-
mandatory:true,
|
|
24
|
-
values: {
|
|
25
|
-
app: {},
|
|
26
|
-
lib: {},
|
|
27
|
-
"cmd-tool": {}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
files:{
|
|
32
|
-
'README.md':{ mandatory:true },
|
|
33
|
-
'LEEME.md':{ mandatory:true },
|
|
34
|
-
'.travis.yml':{ mandatory:true },
|
|
35
|
-
'.gitignore':{
|
|
36
|
-
mandatory:true,
|
|
37
|
-
mandatoryLines:['local-*','*-local.*']
|
|
38
|
-
},
|
|
39
|
-
'LICENSE':{ mandatory:true },
|
|
40
|
-
'appveyor.yml':{
|
|
41
|
-
presentIf:function(packageJson){
|
|
42
|
-
return !!packageJson['qa-control']["test-appveyor"];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
cucardas:{
|
|
47
|
-
'proof-of-concept':{
|
|
48
|
-
check: function(packageJson){
|
|
49
|
-
return packageJson['qa-control'].purpose==='proof-of-concept';
|
|
50
|
-
},
|
|
51
|
-
md:'',
|
|
52
|
-
imgExample:'https://img.shields.io/badge/stability-designing-red.svg'
|
|
53
|
-
},
|
|
54
|
-
designing:{
|
|
55
|
-
check: function(packageJson){
|
|
56
|
-
return semver.satisfies(packageJson.version,'0.0.x') && !packageJson['qa-control'].purpose;
|
|
57
|
-
},
|
|
58
|
-
md:'',
|
|
59
|
-
imgExample:'https://img.shields.io/badge/stability-designing-red.svg',
|
|
60
|
-
docDescription: 'opt. manual'
|
|
61
|
-
},
|
|
62
|
-
extending:{
|
|
63
|
-
check: function(packageJson){
|
|
64
|
-
return semver.satisfies(packageJson.version,'0.x.x') &&
|
|
65
|
-
!semver.satisfies(packageJson.version,'0.0.x') &&
|
|
66
|
-
!packageJson['qa-control'].purpose;
|
|
67
|
-
},
|
|
68
|
-
md:'',
|
|
69
|
-
imgExample:'https://img.shields.io/badge/stability-extending-orange.svg',
|
|
70
|
-
docDescription: 'opt. manual'
|
|
71
|
-
},
|
|
72
|
-
'npm-version':{
|
|
73
|
-
mandatory:true,
|
|
74
|
-
md:'[](https://npmjs.org/package/yyy)',
|
|
75
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/npm-version.png',
|
|
76
|
-
docDescription: ''
|
|
77
|
-
},
|
|
78
|
-
downloads:{
|
|
79
|
-
mandatory:true,
|
|
80
|
-
md:'[](https://npmjs.org/package/yyy)',
|
|
81
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/downloads.png',
|
|
82
|
-
docDescription: ''
|
|
83
|
-
},
|
|
84
|
-
build:{
|
|
85
|
-
check: function(packageJson){
|
|
86
|
-
return !packageJson['qa-control']['test-appveyor'];
|
|
87
|
-
},
|
|
88
|
-
md:'[](https://travis-ci.org/xxx/yyy)',
|
|
89
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-linux.png',
|
|
90
|
-
docDescription: 'linux/build'
|
|
91
|
-
},
|
|
92
|
-
linux:{
|
|
93
|
-
check: function(packageJson){
|
|
94
|
-
return !!packageJson['qa-control']['test-appveyor'];
|
|
95
|
-
},
|
|
96
|
-
md:'[](https://travis-ci.org/xxx/yyy)',
|
|
97
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-linux.png',
|
|
98
|
-
hideInManual: true,
|
|
99
|
-
},
|
|
100
|
-
windows:{
|
|
101
|
-
check: function(packageJson){
|
|
102
|
-
return !!packageJson['qa-control']['test-appveyor'];
|
|
103
|
-
},
|
|
104
|
-
md:'[](https://ci.appveyor.com/project/xxx/yyy)',
|
|
105
|
-
imgExample:'https://ci.appveyor.com/api/projects/status/github/codenautas/pg-promise-strict?svg=true',
|
|
106
|
-
docDescription: 'casos especiales'
|
|
107
|
-
},
|
|
108
|
-
coverage:{
|
|
109
|
-
check: function(packageJson){
|
|
110
|
-
return packageJson['qa-control'].coverage;
|
|
111
|
-
},
|
|
112
|
-
md:'[](https://coveralls.io/r/xxx/yyy)',
|
|
113
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/coverage.png',
|
|
114
|
-
docDescription: ''
|
|
115
|
-
},
|
|
116
|
-
climate:{
|
|
117
|
-
check: function(packageJson){
|
|
118
|
-
return packageJson['qa-control'].coverage || ! packageJson['qa-control'].purpose;
|
|
119
|
-
},
|
|
120
|
-
md:'[](https://codeclimate.com/github/xxx/yyy)',
|
|
121
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/climate.png',
|
|
122
|
-
docDescription: ''
|
|
123
|
-
},
|
|
124
|
-
dependencies:{
|
|
125
|
-
mandatory:true,
|
|
126
|
-
md:'[](https://david-dm.org/xxx/yyy)',
|
|
127
|
-
imgExample:'https://raw.githubusercontent.com/codenautas/codenautas/master/img/medalla-ejemplo-dependencies.png',
|
|
128
|
-
docDescription: ''
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
customs:{
|
|
132
|
-
softRegExp:function(realRegex) {
|
|
133
|
-
var re=realRegex.replace(/\\/g, '\\\\')
|
|
134
|
-
.replace(/\s*(=+)\s*/g,'\\s*$1\\s*')
|
|
135
|
-
.replace(/ /g, '\\s+')
|
|
136
|
-
.replace(/\(/g, '\\(')
|
|
137
|
-
.replace(/\)/g, '\\)');
|
|
138
|
-
return new RegExp(re, 'im');
|
|
139
|
-
},
|
|
140
|
-
funtion_eid:{
|
|
141
|
-
detect:'function eid',
|
|
142
|
-
match:'function eid(id){ return document.getElementById(id); }'
|
|
143
|
-
},
|
|
144
|
-
var_winos:{
|
|
145
|
-
// separo los siguientes dos strings en dos partes para que no salte un warning
|
|
146
|
-
detect:'var '+'winos=',
|
|
147
|
-
match:"var "+"winOS = Path.sep==='\\\\';"
|
|
148
|
-
},
|
|
149
|
-
var_path:{
|
|
150
|
-
detect:'var path=',
|
|
151
|
-
match:"var Path = require('path');"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
jshint_options: { "asi": false, "curly": true, "forin": true },
|
|
155
|
-
// Si info.scoring == true, cada regla debe agregar junto al warning, un objeto 'scoring'
|
|
156
|
-
// con na o mas de las siguientes propiedades:
|
|
157
|
-
// qac: 1
|
|
158
|
-
// mandatories: 1
|
|
159
|
-
// cucardas:1
|
|
160
|
-
// multilang:1
|
|
161
|
-
// versions:1
|
|
162
|
-
// parameters:1
|
|
163
|
-
// format:1
|
|
164
|
-
// customs:1
|
|
165
|
-
// jshint:1
|
|
166
|
-
// dependencies:1
|
|
167
|
-
// Emilio redefinira valores de cada score
|
|
168
|
-
rules:{
|
|
169
|
-
exist_package_json:{
|
|
170
|
-
checks:[{
|
|
171
|
-
warnings:function(info){
|
|
172
|
-
if(!info.files['package.json']){
|
|
173
|
-
return [{warning:'no_package_json', scoring:{mandatories:1}}];
|
|
174
|
-
}
|
|
175
|
-
return [];
|
|
176
|
-
}
|
|
177
|
-
}],
|
|
178
|
-
shouldAbort:true
|
|
179
|
-
},
|
|
180
|
-
qa_control_section_in_package_json:{
|
|
181
|
-
checks:[{
|
|
182
|
-
warnings:function(info){
|
|
183
|
-
if(!info.packageJson['qa-control']){
|
|
184
|
-
return [{warning:info.files['package.json'].content.match(/codenautas/)?
|
|
185
|
-
'no_qa_control_section_in_codenautas_project':
|
|
186
|
-
'no_qa_control_section_in_package_json', scoring:{qac:1}}];
|
|
187
|
-
}
|
|
188
|
-
return [];
|
|
189
|
-
}
|
|
190
|
-
}],
|
|
191
|
-
shouldAbort:true
|
|
192
|
-
},
|
|
193
|
-
package_version_in_qa_control_section:{
|
|
194
|
-
checks:[{
|
|
195
|
-
warnings:function(info){
|
|
196
|
-
if(!info.packageJson['qa-control']['package-version']){
|
|
197
|
-
return [{warning:'no_package_version_in_qa_control_section', scoring:{qac:1}}];
|
|
198
|
-
} else {
|
|
199
|
-
// defino la version para para siguientes checks
|
|
200
|
-
info.packageVersion = info.packageJson['qa-control']['package-version'];
|
|
201
|
-
}
|
|
202
|
-
return [];
|
|
203
|
-
}
|
|
204
|
-
}],
|
|
205
|
-
shouldAbort:true
|
|
206
|
-
},
|
|
207
|
-
invalid_qa_control_version: {
|
|
208
|
-
checks:[{
|
|
209
|
-
warnings:function(info){
|
|
210
|
-
var ver=info.packageVersion;
|
|
211
|
-
if(! semver.valid(ver)){
|
|
212
|
-
return [{warning:'invalid_qa_control_version',params:[ver], scoring:{versions:1}}];
|
|
213
|
-
}
|
|
214
|
-
return [];
|
|
215
|
-
}
|
|
216
|
-
}],
|
|
217
|
-
shouldAbort:true
|
|
218
|
-
},
|
|
219
|
-
deprecated_control_version: {
|
|
220
|
-
checks:[{
|
|
221
|
-
warnings:function(info) {
|
|
222
|
-
var ver=info.packageVersion;
|
|
223
|
-
if(semver.satisfies(ver, qaControl.deprecatedVersions)){
|
|
224
|
-
return [{warning:'deprecated_qa_control_version',params:[ver], scoring:{versions:1}}];
|
|
225
|
-
}
|
|
226
|
-
return [];
|
|
227
|
-
}
|
|
228
|
-
}],
|
|
229
|
-
shouldAbort:true
|
|
230
|
-
},
|
|
231
|
-
mandatory_files:{
|
|
232
|
-
checks:[{
|
|
233
|
-
warnings:function(info) {
|
|
234
|
-
var warns =[];
|
|
235
|
-
var files=qaControl.projectDefinition[info.packageVersion].files;
|
|
236
|
-
/*jshint forin: false */
|
|
237
|
-
for(var fileName in files) {
|
|
238
|
-
if(files.hasOwnProperty(fileName)) {
|
|
239
|
-
var file = files[fileName];
|
|
240
|
-
if(file.mandatory && !info.files[fileName]) {
|
|
241
|
-
warns.push({warning:'lack_of_mandatory_file_1', params:[fileName], scoring:{mandatories:1}});
|
|
242
|
-
} else {
|
|
243
|
-
if(file.presentIf && file.presentIf(info.packageJson) && !info.files[fileName]) {
|
|
244
|
-
warns.push({warning:'lack_of_mandatory_file_1', params:[fileName], scoring:{mandatories:1}});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/*jshint forin: true */
|
|
250
|
-
return warns;
|
|
251
|
-
}
|
|
252
|
-
}],
|
|
253
|
-
shouldAbort:true
|
|
254
|
-
},
|
|
255
|
-
repository_in_package_json:{
|
|
256
|
-
checks:[{
|
|
257
|
-
warnings:function(info) {
|
|
258
|
-
var warns = [];
|
|
259
|
-
if(!('repository' in info.packageJson)) {
|
|
260
|
-
warns.push({warning:'lack_of_repository_section_in_package_json', scoring:{mandatories:1}});
|
|
261
|
-
} else {
|
|
262
|
-
if(! qaControl.getRepositoryUrl(info.packageJson).match(/^([-a-zA-Z0-9_.]+\/[-a-zA-Z0-9_.]+)$/)){
|
|
263
|
-
return [{warning:'repository_name_not_found', scoring:{mandatories:1}}];
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return warns;
|
|
267
|
-
}
|
|
268
|
-
}],
|
|
269
|
-
shouldAbort:true
|
|
270
|
-
},
|
|
271
|
-
valid_values_for_qa_control_keys:{
|
|
272
|
-
checks:[{
|
|
273
|
-
warnings:function(info){
|
|
274
|
-
var warns=[];
|
|
275
|
-
var qaControlSection=info.packageJson['qa-control'];
|
|
276
|
-
var sections=qaControl.projectDefinition[info.packageVersion].sections;
|
|
277
|
-
/*jshint forin: false */
|
|
278
|
-
for(var sectionName in sections){
|
|
279
|
-
var sectionDef=sections[sectionName];
|
|
280
|
-
if(sectionDef.mandatory && !(sectionName in qaControlSection)){
|
|
281
|
-
warns.push({warning:'lack_of_mandatory_section_1',params:[sectionName], scoring:{mandatories:1}});
|
|
282
|
-
}else{
|
|
283
|
-
var observedValue=qaControlSection[sectionName];
|
|
284
|
-
if(sectionDef.values && !(observedValue in sectionDef.values)){
|
|
285
|
-
warns.push({warning:'invalid_value_1_in_parameter_2',params:[observedValue,sectionName], scoring:{parameters:1}});
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/*jshint forin: true */
|
|
290
|
-
return warns;
|
|
291
|
-
}
|
|
292
|
-
}],
|
|
293
|
-
shouldAbort:true
|
|
294
|
-
},
|
|
295
|
-
mandatory_lines:{
|
|
296
|
-
checks:[{
|
|
297
|
-
warnings:function(info) {
|
|
298
|
-
var warns =[];
|
|
299
|
-
var files=qaControl.projectDefinition[info.packageVersion].files;
|
|
300
|
-
for(var fileName in files) {
|
|
301
|
-
var file=files[fileName];
|
|
302
|
-
if(file.mandatoryLines) {
|
|
303
|
-
var fileContent = info.files[fileName].content;
|
|
304
|
-
file.mandatoryLines.forEach(function(mandatoryLine) {
|
|
305
|
-
// agrego '\n' antes para no utilizar expresiones regulares
|
|
306
|
-
if(fileContent.indexOf('\n'+mandatoryLine)===-1) {
|
|
307
|
-
warns.push({warning:'lack_of_mandatory_line_1_in_file_2',
|
|
308
|
-
params:[mandatoryLine, fileName],
|
|
309
|
-
scoring:{mandatories:1}});
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
return warns;
|
|
315
|
-
}
|
|
316
|
-
}]
|
|
317
|
-
},
|
|
318
|
-
no_test_in_node_four:{
|
|
319
|
-
checks:[{
|
|
320
|
-
warnings:function(info){
|
|
321
|
-
if(info.dotTravis && info.dotTravis.node_js.filter(function(x){ return x[0].match(/[45678]/); }).length<2){
|
|
322
|
-
return [{warning:'no_test_in_node_four', scoring:{versions:1}}];
|
|
323
|
-
}
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
}],
|
|
327
|
-
},
|
|
328
|
-
no_multilang_section_in_1:{
|
|
329
|
-
checks:[{
|
|
330
|
-
warnings:function(info){
|
|
331
|
-
if(!info.files[qaControl.mainDoc()].content.match(/<!--multilang v[0-9]+\s+(.+)(-->)/)) {
|
|
332
|
-
return [{
|
|
333
|
-
warning:'no_multilang_section_in_1',
|
|
334
|
-
params:[qaControl.mainDoc()],
|
|
335
|
-
scoring:{multilang:1}
|
|
336
|
-
}];
|
|
337
|
-
}
|
|
338
|
-
return [];
|
|
339
|
-
}
|
|
340
|
-
}]
|
|
341
|
-
},
|
|
342
|
-
invalid_repository_in_package_json:{
|
|
343
|
-
checks:[{
|
|
344
|
-
warnings:function(info) {
|
|
345
|
-
var warns = [];
|
|
346
|
-
var repoParts = qaControl.getRepositoryUrl(info.packageJson).split('/');
|
|
347
|
-
var projName = repoParts[repoParts.length-1];
|
|
348
|
-
if(projName !== info.packageJson.name) {
|
|
349
|
-
return [{warning:'invalid_repository_section_in_package_json', scoring:{format:1}}];
|
|
350
|
-
}
|
|
351
|
-
return warns;
|
|
352
|
-
}
|
|
353
|
-
}]
|
|
354
|
-
},
|
|
355
|
-
cucardas:{
|
|
356
|
-
eclipsers:['invalid_repository_section_in_package_json', 'lack_of_repository_section_in_package_json'],
|
|
357
|
-
checks:[{
|
|
358
|
-
warnings:function(info){
|
|
359
|
-
var warns=[];
|
|
360
|
-
var readme=info.files[qaControl.mainDoc()].content;
|
|
361
|
-
if(readme.indexOf(qaControl.cucaMarker) === -1) {
|
|
362
|
-
warns.push({warning:'lack_of_cucarda_marker_in_readme'});
|
|
363
|
-
}
|
|
364
|
-
var cucardas=qaControl.projectDefinition[info.packageVersion].cucardas;
|
|
365
|
-
var modulo=info.packageJson.name;
|
|
366
|
-
var repo=qaControl.getRepositoryUrl(info.packageJson).replace('/'+modulo,'');
|
|
367
|
-
/*jshint forin: false */
|
|
368
|
-
for(var nombreCucarda in cucardas) {
|
|
369
|
-
var cucarda = cucardas[nombreCucarda];
|
|
370
|
-
var cucaID = '!['+/!\[([-a-z]+)]/.exec(cucarda.md)[1]+']';
|
|
371
|
-
var cucaStr = cucarda.md.replace(/\bxxx\b/g,repo).replace(/\byyy\b/g,modulo);
|
|
372
|
-
if(readme.indexOf(cucaID) === -1) {
|
|
373
|
-
if(cucarda.mandatory) {
|
|
374
|
-
warns.push({warning:'lack_of_mandatory_cucarda_1', params:[nombreCucarda], scoring:{cucardas:1}});
|
|
375
|
-
}
|
|
376
|
-
} else {
|
|
377
|
-
if('check' in cucarda && ! cucarda.check(info.packageJson)) {
|
|
378
|
-
warns.push({warning:'wrong_format_in_cucarda_1', params:[nombreCucarda], scoring:{cucardas:1}});
|
|
379
|
-
}
|
|
380
|
-
if(readme.indexOf(cucaStr) === -1) {
|
|
381
|
-
// si tengo cucarda mal formada, devuelvo warning aunque no sea obligatoria
|
|
382
|
-
// porque existio la intencion de definirla
|
|
383
|
-
warns.push({warning:'wrong_format_in_cucarda_1', params:[nombreCucarda], scoring:{cucardas:1}});
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
/*jshint forin: true */
|
|
388
|
-
if(warns.length || qaControl.cucardas_always) {
|
|
389
|
-
fs.writeFile(Path.normalize(info.projectDir+'/cucardas.log'), qaControl.generateCucardas(cucardas, info.packageJson));
|
|
390
|
-
}
|
|
391
|
-
return warns;
|
|
392
|
-
}
|
|
393
|
-
}]
|
|
394
|
-
},
|
|
395
|
-
customs:{
|
|
396
|
-
checks:[{
|
|
397
|
-
warnings:function(info) {
|
|
398
|
-
var warns=[];
|
|
399
|
-
var customs = qaControl.projectDefinition[info.packageVersion].customs;
|
|
400
|
-
function makeCheck(strOrRegexp, isMatchFunc) {
|
|
401
|
-
var checker;
|
|
402
|
-
if(!strOrRegexp){
|
|
403
|
-
checker=function() { return false; };
|
|
404
|
-
}else if(strOrRegexp instanceof RegExp) {
|
|
405
|
-
checker=function(str) {
|
|
406
|
-
return strOrRegexp.test(str);
|
|
407
|
-
};
|
|
408
|
-
} else {
|
|
409
|
-
checker=function(str) {
|
|
410
|
-
if(isMatchFunc) {
|
|
411
|
-
return str.indexOf(strOrRegexp) !== -1;
|
|
412
|
-
} else {
|
|
413
|
-
return customs.softRegExp(strOrRegexp).test(str);
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
return checker;
|
|
418
|
-
}
|
|
419
|
-
/*jshint forin: false */
|
|
420
|
-
for(var file in info.files) {
|
|
421
|
-
if(file.match(/(.js)$/)) {
|
|
422
|
-
for(var customeName in customs) {
|
|
423
|
-
if(customs.hasOwnProperty(customeName)) {
|
|
424
|
-
var content = info.files[file].content;
|
|
425
|
-
var custom = customs[customeName];
|
|
426
|
-
var detect = makeCheck(custom.detect);
|
|
427
|
-
var match = makeCheck(custom.match, true);
|
|
428
|
-
//console.log(file, " detect:", detect(content), " match: ", match(content))
|
|
429
|
-
if(detect(content) && ! match(content)) {
|
|
430
|
-
warns.push({warning:'file_1_does_not_match_custom_2', params:[file,customeName], scoring:{customs:1}});
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
/*jshint forin: true */
|
|
437
|
-
return warns;
|
|
438
|
-
}
|
|
439
|
-
}]
|
|
440
|
-
},
|
|
441
|
-
first_lines:{
|
|
442
|
-
checks:[{
|
|
443
|
-
warnings:function(info) {
|
|
444
|
-
var warns=[];
|
|
445
|
-
var qaControlSection=info.packageJson['qa-control'];
|
|
446
|
-
var whichRunIn=qaControlSection['run-in'];
|
|
447
|
-
var whichType=qaControlSection.type;
|
|
448
|
-
var firstLines=qaControl.projectDefinition[info.packageVersion].firstLines[whichRunIn][whichType];
|
|
449
|
-
if(firstLines) {
|
|
450
|
-
var ProjectName = qaControl.jsProjectName(info.packageJson.name);
|
|
451
|
-
var projectName = qaControl.first("toLowerCase")(ProjectName);
|
|
452
|
-
var mainName = ('main' in info.packageJson) ? info.packageJson.main : 'index.js';
|
|
453
|
-
if(!(mainName in info.files)) {
|
|
454
|
-
warns.push({warning:'packagejson_main_file_1_does_not_exists', params:[mainName], scoring:{customs:1}});
|
|
455
|
-
} else {
|
|
456
|
-
var fileContent = stripBom(info.files[mainName].content);
|
|
457
|
-
|
|
458
|
-
if(!qaControl.startsWith(fileContent, firstLines.replace(/nombreDelModulo/g, ProjectName)) &&
|
|
459
|
-
!qaControl.startsWith(fileContent, firstLines.replace(/nombreDelModulo/g, projectName))
|
|
460
|
-
) {
|
|
461
|
-
if(qaControl.verbose){
|
|
462
|
-
var code=qaControl.fixEOL(fileContent);
|
|
463
|
-
var model1=qaControl.fixEOL(firstLines.replace(/nombreDelModulo/g, projectName));
|
|
464
|
-
var model2=qaControl.fixEOL(firstLines.replace(/nombreDelModulo/g, ProjectName));
|
|
465
|
-
/*jshint forin: false */
|
|
466
|
-
for(var i=0; i<model1.length; i++){
|
|
467
|
-
if(code[i]!== model1[i] && code[i] !== model2[i]){
|
|
468
|
-
console.log('RUN-IN', whichRunIn);
|
|
469
|
-
console.log('DIF STARTS IN:',JSON.stringify(code.substring(i, Math.min(model1.length, i+20))));
|
|
470
|
-
console.log('MODEL 1 :',JSON.stringify(model1.substring(i, Math.min(model1.length, i+20))));
|
|
471
|
-
console.log('MODEL 2 :',JSON.stringify(model2.substring(i, Math.min(model1.length, i+20))));
|
|
472
|
-
console.log('FOR MODULE NAME:',projectName,'OR',ProjectName);
|
|
473
|
-
break;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
/*jshint forin: true */
|
|
477
|
-
}
|
|
478
|
-
warns.push({warning:'first_lines_does_not_match_in_file_1', params:[mainName], scoring:{customs:1}});
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
return warns;
|
|
483
|
-
}
|
|
484
|
-
}]
|
|
485
|
-
},
|
|
486
|
-
normal_promises:{
|
|
487
|
-
checks:[{
|
|
488
|
-
warnings:function(info){
|
|
489
|
-
var warns = [];
|
|
490
|
-
/*jshint forin: false */
|
|
491
|
-
for(var file in info.files) {
|
|
492
|
-
if(file.match(/(.js)$/)) {
|
|
493
|
-
var content = info.files[file].content;
|
|
494
|
-
if(content.match(/require\(["'](promise|q|rsvp|es6promise)['"]\)/m)) {
|
|
495
|
-
warns.push({warning:'using_normal_promise_in_file_1', params:[file], scoring:{customs:1}});
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
/*jshint forin: true */
|
|
500
|
-
return warns;
|
|
501
|
-
}
|
|
502
|
-
}]
|
|
503
|
-
},
|
|
504
|
-
jshint_config:{
|
|
505
|
-
checks:[{
|
|
506
|
-
warnings:function(info){
|
|
507
|
-
return qaControl.checkLintConfig(info,
|
|
508
|
-
'jshintConfig',
|
|
509
|
-
'lack_of_jshintconfig_section_in_package_json',
|
|
510
|
-
qaControl.projectDefinition[info.packageVersion].jshint_options,
|
|
511
|
-
'incorrect_jshintconfig_option_1_in_package_json',
|
|
512
|
-
{jshint:1});
|
|
513
|
-
}
|
|
514
|
-
}]
|
|
515
|
-
},
|
|
516
|
-
jshint:{
|
|
517
|
-
eclipsers:['packagejson_main_file_1_does_not_exists', 'first_lines_does_not_match_in_file_1',
|
|
518
|
-
'lack_of_jshintconfig_section_in_package_json', 'incorrect_jshintconfig_option_1_in_package_json'],
|
|
519
|
-
checks:[{
|
|
520
|
-
warnings:function(info){
|
|
521
|
-
var warns = [];
|
|
522
|
-
var jshintOpts =
|
|
523
|
-
info.packageJson.jshintConfig ||
|
|
524
|
-
qaControl.projectDefinition[info.packageVersion].jshint_options;
|
|
525
|
-
/*jshint forin: false */
|
|
526
|
-
for(var file in info.files) {
|
|
527
|
-
if(file.match(/(.js)$/)) {
|
|
528
|
-
var content = info.files[file].content;
|
|
529
|
-
jsh.JSHINT(content, jshintOpts , false);
|
|
530
|
-
var data = jsh.JSHINT.data();
|
|
531
|
-
if(data.errors) {
|
|
532
|
-
if(qaControl.verbose){
|
|
533
|
-
console.log('JSHINT output:');
|
|
534
|
-
console.log('jshintOpts',jshintOpts);
|
|
535
|
-
console.log(data.errors.length, " JSHINT errors");
|
|
536
|
-
console.log(data.errors);
|
|
537
|
-
//console.log(data);
|
|
538
|
-
}
|
|
539
|
-
warns.push({warning:'jshint_warnings_in_file_1', params:[file], scoring:{jshint:1}});
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
/*jshint forin: true */
|
|
544
|
-
return warns;
|
|
545
|
-
}
|
|
546
|
-
}]
|
|
547
|
-
},
|
|
548
|
-
multilang:{
|
|
549
|
-
checks:[{
|
|
550
|
-
warnings:function(info) {
|
|
551
|
-
var warns = [];
|
|
552
|
-
var defReadme = qaControl.mainDoc();
|
|
553
|
-
var content = info.files[defReadme].content;
|
|
554
|
-
var obtainedLangs = multilang.obtainLangs(content);
|
|
555
|
-
/*jshint forin: false */
|
|
556
|
-
for(var lang in obtainedLangs.langs) {
|
|
557
|
-
var file=obtainedLangs.langs[lang].fileName;
|
|
558
|
-
if(file !== defReadme) {
|
|
559
|
-
var mlContent = multilang.changeNamedDoc(file, content, lang);
|
|
560
|
-
if(mlContent !== info.files[file].content) {
|
|
561
|
-
warns.push({warning:'readme_multilang_not_sincronized_with_file_1', params:[file], scoring:{multilang:1}});
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
/*jshint forin: true */
|
|
566
|
-
return warns;
|
|
567
|
-
}
|
|
568
|
-
}]
|
|
569
|
-
},
|
|
570
|
-
dependencies:{
|
|
571
|
-
checks:[{
|
|
572
|
-
warnings:qaControl.checkDepVerNumberFormat
|
|
573
|
-
}]
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*jshint eqnull:true */
|
|
3
|
-
/*jshint globalstrict:true */
|
|
4
|
-
/*jshint node:true */
|
|
5
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
6
|
-
/* global define */
|
|
7
|
-
/* global globalModuleName */
|
|
8
|
-
/* istanbul ignore next */
|
|
9
|
-
if(typeof root.globalModuleName !== 'string'){
|
|
10
|
-
root.globalModuleName = factory.name;
|
|
11
|
-
}
|
|
12
|
-
/* istanbul ignore next */
|
|
13
|
-
if(typeof exports === 'object' && typeof module === 'object'){
|
|
14
|
-
module.exports = factory();
|
|
15
|
-
}else if(typeof define === 'function' && define.amd){
|
|
16
|
-
define(factory);
|
|
17
|
-
}else if(typeof exports === 'object'){
|
|
18
|
-
exports[root.globalModuleName] = factory();
|
|
19
|
-
}else{
|
|
20
|
-
root[root.globalModuleName] = factory();
|
|
21
|
-
}
|
|
22
|
-
root.globalModuleName = null;
|
|
23
|
-
})(/*jshint -W040 */this, function nombreDelModulo() {
|
|
24
|
-
/*jshint +W040 */
|
|
25
|
-
|
|
26
|
-
/*jshint -W004 */
|
|
27
|
-
var nombreDelModulo = {};
|
|
28
|
-
/*jshint +W004 */
|