crabatool 1.0.111 → 1.0.112

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tool/checkjs.js +27 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.111",
3
+ "version": "1.0.112",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tool/checkjs.js CHANGED
@@ -197,11 +197,28 @@ module.exports.start = async function() {
197
197
  // 输出到钉钉的简易报告
198
198
  //if (errKeys.length > 0) {
199
199
  webhookList.push(`1. 语法异常文件数Error:${errKeys.length}个`);
200
+ var list0 = [];
201
+ var errCount = errKeys.length;
202
+ while (list0.length < 6 && list0.length < errCount) {
203
+ var i = Math.floor(Math.random() * errCount);
204
+ var fileName = errKeys[i];
205
+ if (list0.includes(fileName)) continue;
206
+ list0.push(fileName);
207
+ }
208
+
209
+ webhookList.push(`1. 语法异常文件清单随机5个(${list0.join(';')})`);
210
+ if (errKeys.length > 5) {
211
+ var reportUrl1 = getReportUrl(id, 2);
212
+ if (reportUrl1) {
213
+ webhookList.push(`[更多异常...](${reportUrl1})`);
214
+ }
215
+ }
216
+
200
217
  //}
201
218
  //if (warnKeys.length > 0) {
202
- webhookList.push(`1. 语法警告文件数Warn:${warnKeys.length}个`);
219
+ webhookList.push(`7. 语法警告文件数Warn:${warnKeys.length}个`);
203
220
  //}
204
- webhookList.push(`1. 语法提示文件数Info:${infoKeys.length}个`);
221
+ webhookList.push(`8. 语法提示文件数Info:${infoKeys.length}个`);
205
222
  if (notUtf8List.length > 0) {
206
223
  webhookList.push(`1. 非utf8文件数:${notUtf8List.length}个`);
207
224
  }
@@ -209,10 +226,10 @@ module.exports.start = async function() {
209
226
  webhookList.push(`1. 超过${fileSize}kb的文件数:${bigList.length}个`);
210
227
  }
211
228
  //if (warnGspxCount > 0) {
212
- webhookList.push(`1. gspx建议优化数:${warnGspxCount}个`);
229
+ webhookList.push(`9. gspx建议优化数:${warnGspxCount}个`);
213
230
  //}
214
231
  if (gspxData.errorList.length > 0) {
215
- webhookList.push(`1. gspx语法错误数:${gspxData.errorList.length}个`);
232
+ webhookList.push(`10. gspx语法错误数:${gspxData.errorList.length}个`);
216
233
  }
217
234
 
218
235
  // 代码质量管理需要格式
@@ -400,9 +417,13 @@ function getSonarEntity(type, modName, message, filePath, line, column, endLine)
400
417
  return entity;
401
418
  }
402
419
 
403
- function getReportUrl(id) {
420
+ function getReportUrl(id, anchor) {
404
421
  if (!config.reportHost) return '';
405
- return config.reportHost + "/index.html#%2FPages%2FReport%2FJsReport.gspx?id=" + id;
422
+ var href = config.reportHost + "/index.html#%2FPages%2FReport%2FJsReport.gspx?id=" + id;
423
+ if (anchor) {
424
+ href += "&toc=anchor-" + anchor;
425
+ }
426
+ return href;
406
427
  }
407
428
 
408
429
  function getModName() {