crabatool 1.0.200 → 1.0.210

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/.eslintrc.json CHANGED
@@ -77,6 +77,9 @@
77
77
  "crabaVersion": "readonly",
78
78
  "crabaDate": "readonly",
79
79
  "StringUtils": "readonly",
80
- "convertGridData":"readonly"
80
+ "convertGridData": "readonly",
81
+ "__pathMapName": "readonly",
82
+ "CrabaLanguage": "readonly",
83
+ "NGPLanguage": "readonly"
81
84
  }
82
85
  }
package/index.js CHANGED
@@ -28,6 +28,13 @@ function checkFast(args) {
28
28
  return true;
29
29
  }
30
30
 
31
+ // convert version
32
+ if (!config.version || config.version == 'NewCraba') {
33
+ config.version = 'master';
34
+ }
35
+ else if (config.version == 'NewCraba_temp') {
36
+ config.version = 'master_temp';
37
+ }
31
38
  if (process.env.REMOTE_BUILD == 'no') {
32
39
  config.version += '_temp';
33
40
  }
package/lib/utils.js CHANGED
@@ -293,15 +293,18 @@ class Utils {
293
293
  }
294
294
 
295
295
  // 递归创建目录
296
- mkdirsSync(dirname) {
297
- var basename = path.basename(dirname);
298
- if (basename.indexOf('.') > 0) {
299
- dirname = path.dirname(dirname);
296
+ mkdirsSync(dirname, isFolder) {
297
+ this.debug(dirname);
298
+ if (!isFolder) {
299
+ var basename = path.basename(dirname);
300
+ if (basename.indexOf('.') > 0) {
301
+ dirname = path.dirname(dirname);
302
+ }
300
303
  }
301
304
  if (fs.existsSync(dirname)) {
302
305
  return true;
303
306
  }
304
- if (utils.mkdirsSync(path.dirname(dirname))) {
307
+ if (utils.mkdirsSync(path.dirname(dirname), true)) {
305
308
  fs.mkdirSync(dirname);
306
309
  return true;
307
310
  }
@@ -431,7 +434,9 @@ class Utils {
431
434
  });
432
435
  }
433
436
 
434
- if (!fileList) fileList = [];
437
+ if (!fileList) {
438
+ fileList = [];
439
+ }
435
440
 
436
441
  if (!fs.existsSync(source)) {
437
442
  return fileList;
@@ -440,7 +445,8 @@ class Utils {
440
445
  var files = fs.readdirSync(source);
441
446
  files.forEach(function(fileName) {
442
447
  var filePath = utils.join(source, fileName);
443
- if (options.ignores && options.ignores.includes(filePath)) {
448
+ // 包含路径或文件名,都忽略掉
449
+ if (options.ignores && (options.ignores.includes(filePath) || options.ignores.includes(fileName))) {
444
450
  return;
445
451
  }
446
452
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.200",
3
+ "version": "1.0.210",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
package/tool/checkjs.js CHANGED
@@ -271,11 +271,11 @@ module.exports.start = async function() {
271
271
  detail.push(`${index + 1}. ${fileName}`);
272
272
 
273
273
  var infoList = errDatas[fileName];
274
- detail.push("| 异常字符 | 行号 | 列号 | 说明 |");
274
+ detail.push("| 类型 | 行号 | 列号 | 说明 |");
275
275
  detail.push("| ----- | ------ | ---- | ---- |");
276
276
  infoList.forEach((item) => {
277
277
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
278
- sonar.issues.push(getSonarEntity('语法异常', modName, item.char.trim(), fileName, -1, item.line, item.column, item.endLine));
278
+ sonar.issues.push(getSonarEntity('语法异常', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
279
279
  });
280
280
  });
281
281
  //}
@@ -288,11 +288,11 @@ module.exports.start = async function() {
288
288
  detail.push(`${index + 1}. ${fileName}`);
289
289
 
290
290
  var infoList = warnDatas[fileName];
291
- detail.push("| 警告字符 | 行号 | 列号 | 说明 |");
291
+ detail.push("| 类型 | 行号 | 列号 | 说明 |");
292
292
  detail.push("| ----- | ------ | ---- | ---- |");
293
293
  infoList.forEach((item) => {
294
294
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
295
- sonar.issues.push(getSonarEntity('语法警告', modName, item.char.trim(), fileName, -1, item.line, item.column, item.endLine));
295
+ sonar.issues.push(getSonarEntity('语法警告', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
296
296
  });
297
297
  });
298
298
  //}
@@ -306,11 +306,11 @@ module.exports.start = async function() {
306
306
  detail.push(`${index + 1}. ${fileName}`);
307
307
 
308
308
  var infoList = infoDatas[fileName];
309
- detail.push("| 提示字符 | 行号 | 列号 | 说明 |");
309
+ detail.push("| 类型 | 行号 | 列号 | 说明 |");
310
310
  detail.push("| ----- | ------ | ---- | ---- |");
311
311
  infoList.forEach((item) => {
312
312
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
313
- sonar.issues.push(getSonarEntity('语法提示', modName, item.char.trim(), fileName, -1, item.line, item.column, item.endLine));
313
+ sonar.issues.push(getSonarEntity('语法提示', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
314
314
  });
315
315
  });
316
316
  //}
@@ -321,7 +321,7 @@ module.exports.start = async function() {
321
321
  notUtf8List.forEach((s, index) => {
322
322
  detail.push(`${index + 1}. ${s}`);
323
323
 
324
- sonar.issues.push(getSonarEntity('非utf8', modName, '', s, -1, -1));
324
+ sonar.issues.push(getSonarEntity('非utf8', modName, '', '', s, -1, -1, -1));
325
325
  });
326
326
  }
327
327
 
@@ -331,7 +331,7 @@ module.exports.start = async function() {
331
331
  bigList.forEach((s, index) => {
332
332
  detail.push(`${index + 1}. ${s}`);
333
333
  var arr = s.split(' ');
334
- sonar.issues.push(getSonarEntity(`超${fileSize}kb文件`, modName, arr[1], arr[0], -1, -1));
334
+ sonar.issues.push(getSonarEntity(`超${fileSize}kb文件`, modName, arr[1], '', arr[0], -1, -1));
335
335
  });
336
336
  }
337
337
 
@@ -460,10 +460,10 @@ function getMathReuslts(content, nreg, filterFun) {
460
460
  return list;
461
461
  }
462
462
 
463
- function getSonarEntity(type, modName, message, filePath, line, column, endLine) {
463
+ function getSonarEntity(type, modName, ruleId, message, filePath, line, column, endLine) {
464
464
  var entity = {
465
465
  "engineId": modName,
466
- "ruleId": "no-undef", // 规则名称,例如不使用const
466
+ "ruleId": ruleId, // 规则名称,例如不使用const
467
467
  "primaryLocation": {
468
468
  "message": message, // 提示信息
469
469
  "filePath": filePath, // 所在文件
@@ -480,7 +480,10 @@ function getSonarEntity(type, modName, message, filePath, line, column, endLine)
480
480
  }
481
481
 
482
482
  function getReportUrl(id, anchor) {
483
- if (!config.reportHost) return '';
483
+ if (!config.reportHost) {
484
+ return '';
485
+ }
486
+
484
487
  var href = config.reportHost + "/index.html#%2FPages%2FReport%2FJsReport.gspx?id=" + id;
485
488
  if (anchor) {
486
489
  href += "&toc=anchor-" + anchor;
@@ -538,7 +541,10 @@ function postWebhooks(id, reportUrl, webhookList) {
538
541
  return;
539
542
  }
540
543
 
541
- if (reportUrl) webhookList.push(`[报告详情](${reportUrl})`);
544
+ if (reportUrl) {
545
+ webhookList.push(`[报告详情](${reportUrl})`);
546
+ webhookList.push("[导出excel](" + config.reportHost + "/apis/downloadReport?id=" + id + ")");
547
+ }
542
548
  var content = webhookList.join(' \n');// 推送到钉钉只推送详情
543
549
 
544
550
  var data = {
@@ -74,6 +74,7 @@ function doUploadCraba(version) {
74
74
  data: formData,
75
75
  headers: {
76
76
  ...headers,
77
+ craba: 1,
77
78
  version: version,
78
79
  token: 'wssf2021' // 临时授权码
79
80
  }
@@ -99,7 +100,14 @@ function doAutoTest() {
99
100
 
100
101
  utils.postWeebhooks(msg + '\r\n开始触发自动化测试');
101
102
 
102
- var url = 'http://jci.ca.com/job/craba-uitest/buildWithParameters?token=remoteBuild&remoteBuild=yes&version';
103
+ var version = config.version;
104
+ if (version.indexOf('_temp')) {
105
+ version = version.replace('_temp', '');
106
+ }
107
+ if (version == 'master') {
108
+ version = 'NewCraba';
109
+ }
110
+ var url = 'http://jci.ca.com/job/craba-uitest/buildWithParameters?token=remoteBuild&remoteBuild=yes&version=' + version;
103
111
  axios({
104
112
  method: 'GET',
105
113
  url: url
@@ -239,7 +239,7 @@ function compressFile(filePath, options, filePath2) {
239
239
  function copyFileToCache1(filePath, stats) {
240
240
  var cachePath = getCachePath1(filePath);
241
241
  utils.debug("拷贝到缓存1:" + cachePath);
242
- utils.mkdirsSync(cachePath)
242
+ utils.mkdirsSync(cachePath);
243
243
 
244
244
  fs.copyFileSync(filePath, cachePath);
245
245
  fs.utimesSync(cachePath, stats.atime, stats.mtime); // 必须同步文件时间