crabatool 1.0.318 → 1.0.321

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.318",
3
+ "version": "1.0.321",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
package/tool/checkjs.js CHANGED
@@ -156,15 +156,13 @@ module.exports.start = async function() {
156
156
  }
157
157
 
158
158
  // trimEnd检查
159
- var tstr = `\.trimEnd\(([^,)]+)\)|\.trimEnd\(['"],['"]\)`;
160
- var reg1 = new RegExp(tstr);
161
- if (reg1.test(content)) {
159
+ var tstr = /\.trimEnd\(([^,)]+)\)|\.trimEnd\(['"],['"]\)/g;
160
+ if (tstr.test(content)) {
162
161
  var noComment = utils.clearComment(content);// 去掉注释的代码再查一遍;因为js里面有些危险字符是被注释了的
163
162
 
164
163
  // 二次检查
165
- if (reg1.test(noComment)) {
166
- var nreg = new RegExp(tstr);
167
- var infoList = getMathReuslts(noComment, nreg, null, 'trimEnd(xx)使用不规范,不支持参数替换;请调整为trimEndChar(xx)');
164
+ if (tstr.test(noComment)) {
165
+ var infoList = getMathReuslts(noComment, tstr, null, 'trimEnd(xx)使用不规范,不支持参数替换;请调整为trimEndChar(xx)');
168
166
  var list = trimErrDatas[filePath];
169
167
  if (list) trimErrDatas[filePath] = list.concat(infoList); // 记录该js有异常
170
168
  else trimErrDatas[filePath] = infoList;
@@ -322,7 +320,7 @@ module.exports.start = async function() {
322
320
  detail.push("| ----- | ------ | ---- | ---- |");
323
321
  infoList.forEach((item) => {
324
322
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
325
- //sonar.issues.push(getSonarEntity('语法异常', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
323
+ sonar.issues.push(getSonarEntity('语法异常', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
326
324
  });
327
325
  });
328
326
  //}
@@ -339,7 +337,7 @@ module.exports.start = async function() {
339
337
  detail.push("| ----- | ------ | ---- | ---- |");
340
338
  infoList.forEach((item) => {
341
339
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
342
- //sonar.issues.push(getSonarEntity('trimEnd异常', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
340
+ sonar.issues.push(getSonarEntity('trimEnd异常', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
343
341
  });
344
342
  });
345
343
  }
@@ -356,7 +354,7 @@ module.exports.start = async function() {
356
354
  detail.push("| ----- | ------ | ---- | ---- |");
357
355
  infoList.forEach((item) => {
358
356
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
359
- //sonar.issues.push(getSonarEntity('语法警告', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
357
+ sonar.issues.push(getSonarEntity('语法警告', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
360
358
  });
361
359
  });
362
360
  //}
@@ -374,7 +372,7 @@ module.exports.start = async function() {
374
372
  detail.push("| ----- | ------ | ---- | ---- |");
375
373
  infoList.forEach((item) => {
376
374
  detail.push(`| ${item.char.trim()} | ${item.line || '-'} | ${item.column || '-'} | ${item.msg || '-'} |`);
377
- //sonar.issues.push(getSonarEntity('语法提示', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
375
+ sonar.issues.push(getSonarEntity('语法提示', modName, item.char.trim(), item.msg, fileName, item.line, item.column, item.endLine));
378
376
  });
379
377
  });
380
378
  //}
@@ -385,7 +383,7 @@ module.exports.start = async function() {
385
383
  notUtf8List.forEach((s, index) => {
386
384
  detail.push(`${index + 1}. ${s}`);
387
385
 
388
- //sonar.issues.push(getSonarEntity('非utf8', modName, '', '', s, -1, -1, -1));
386
+ sonar.issues.push(getSonarEntity('非utf8', modName, '', '', s, -1, -1, -1));
389
387
  });
390
388
  }
391
389
 
@@ -395,7 +393,7 @@ module.exports.start = async function() {
395
393
  bigList.forEach((s, index) => {
396
394
  detail.push(`${index + 1}. ${s}`);
397
395
  var arr = s.split(' ');
398
- //sonar.issues.push(getSonarEntity(`超${fileSize}kb文件`, modName, arr[1], '', arr[0], -1, -1));
396
+ sonar.issues.push(getSonarEntity(`超${fileSize}kb文件`, modName, arr[1], '', arr[0], -1, -1));
399
397
  });
400
398
  }
401
399
 
@@ -524,7 +522,7 @@ function getMathReuslts(content, nreg, filterFun, msg) {
524
522
  }
525
523
  return list;
526
524
  }
527
- /*
525
+
528
526
  function getSonarEntity(type, modName, ruleId, message, filePath, line, column, endLine) {
529
527
  var entity = {
530
528
  "engineId": modName,
@@ -543,7 +541,7 @@ function getSonarEntity(type, modName, ruleId, message, filePath, line, column,
543
541
  }
544
542
  return entity;
545
543
  }
546
- */
544
+
547
545
  function getReportUrl(id, anchor) {
548
546
  if (!config.reportHost) {
549
547
  return '';
@@ -574,8 +572,8 @@ function postReport(id, reportUrl, content, sonar) {
574
572
  "title": getModName() + " 代码检测报告",
575
573
  "id": id,
576
574
  "text": content
577
- }
578
- //sonar: sonar // 代码质量管理系统需要,一起提交到文档保存到文档服务器
575
+ },
576
+ sonar: sonar // 代码质量管理系统需要,一起提交到文档保存到文档服务器
579
577
  };
580
578
 
581
579
  axios({
package/tool/start.js CHANGED
@@ -91,6 +91,8 @@ class Start {
91
91
  { name: '-globals', type: 'array' },
92
92
 
93
93
  { name: '-ignoreCompress', type: 'boolean' },
94
+ { name: '-refresh', type: 'boolean' },
95
+
94
96
  { name: '-hidejspath', type: 'boolean' },
95
97
  { name: '-Debug', type: 'boolean' },
96
98
  { name: '-checkgspx', type: 'boolean' },