crabatool 1.0.280 → 1.0.281
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 +1 -1
- package/tool/checkjs.js +34 -1
package/package.json
CHANGED
package/tool/checkjs.js
CHANGED
|
@@ -158,6 +158,10 @@ module.exports.start = async function() {
|
|
|
158
158
|
var errKeys = Object.keys(errDatas);
|
|
159
159
|
var warnKeys = Object.keys(warnDatas);
|
|
160
160
|
var infoKeys = Object.keys(infoDatas);
|
|
161
|
+
var reportData = {
|
|
162
|
+
projectName: getModName(),
|
|
163
|
+
branchName: getBranchName(),
|
|
164
|
+
}
|
|
161
165
|
if (errKeys.length > 0 || warnKeys.length > 0 || notUtf8List.length > 0 || warnGspxCount > 0 || gspxData.errorList.length > 0) {
|
|
162
166
|
status = '有异常';
|
|
163
167
|
}
|
|
@@ -168,6 +172,8 @@ module.exports.start = async function() {
|
|
|
168
172
|
var webhookList = [];
|
|
169
173
|
var info = [];
|
|
170
174
|
var localVersion = upgrade.getLocalVersion();
|
|
175
|
+
var generateDate = new Date().toString();
|
|
176
|
+
reportData.date = generateDate;
|
|
171
177
|
info.push(`# ${modName}代码检测报告`);
|
|
172
178
|
webhookList.push(info[0]);
|
|
173
179
|
|
|
@@ -178,7 +184,7 @@ module.exports.start = async function() {
|
|
|
178
184
|
info.push(`| 平台版本 | ${localVersion.version} |`);
|
|
179
185
|
info.push(`| 平台日期 | ${localVersion.date} |`);
|
|
180
186
|
}
|
|
181
|
-
info.push(`| 生成报告时间 | ${
|
|
187
|
+
info.push(`| 生成报告时间 | ${generateDate} |`);
|
|
182
188
|
info.push(`| 分支名 | ${branchName} |`);
|
|
183
189
|
info.push(`| 检测主机 | ${utils.getHostName()}(${utils.getLocalIPs()}) |`);
|
|
184
190
|
info.push(`| 网站路径 | ${config.webPath} |`);
|
|
@@ -206,6 +212,17 @@ module.exports.start = async function() {
|
|
|
206
212
|
info.push(`| gspx页面异常数 | ${gspxData.errorList.length}个 |${calc(gspxData.errorList.length, gspxData.count)}|`);
|
|
207
213
|
}
|
|
208
214
|
|
|
215
|
+
reportData.data = {
|
|
216
|
+
errorCount: errKeys.length,
|
|
217
|
+
warnCount: errKeys.length,
|
|
218
|
+
tipCount: errKeys.length,
|
|
219
|
+
fileSize: fileSize,
|
|
220
|
+
fileSizeCount: bigList.length,
|
|
221
|
+
gspxWarnCount: warnGspxCount.length,
|
|
222
|
+
gspxErrorCount: gspxData.errorList.length,
|
|
223
|
+
jsTotal: jsFiles.length,
|
|
224
|
+
gspxTotal: gspxData.count
|
|
225
|
+
}
|
|
209
226
|
|
|
210
227
|
webhookList.push(`1. 助手版本:${config.Version} `);
|
|
211
228
|
if (localVersion.version) {
|
|
@@ -380,6 +397,7 @@ module.exports.start = async function() {
|
|
|
380
397
|
var reportUrl = getReportUrl(id);
|
|
381
398
|
var content = info.concat(detail).join(' \r\n');
|
|
382
399
|
postReport(id, reportUrl, content, sonar);
|
|
400
|
+
postReportData(reportData)
|
|
383
401
|
|
|
384
402
|
// 推送到钉钉
|
|
385
403
|
if (status != '无异常') { // 检查结果检查就不发到钉钉了; ps:健康也发到钉钉,鼓励开发继续保持;
|
|
@@ -588,4 +606,19 @@ function postWebhooks(id, reportUrl, webhookList) {
|
|
|
588
606
|
//console.log(error);
|
|
589
607
|
});
|
|
590
608
|
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
function postReportData(data) {
|
|
612
|
+
axios({
|
|
613
|
+
method: 'post',
|
|
614
|
+
url: config.reportHost + '/apis/saveReportData',
|
|
615
|
+
data: data,
|
|
616
|
+
headers: { 'Content-Type': 'application/json' }
|
|
617
|
+
}).then(function(response) {
|
|
618
|
+
console.log("推送报告数据");
|
|
619
|
+
//console.log(response.data);
|
|
620
|
+
}).catch(function(error) {
|
|
621
|
+
console.log("推送报告数据:" + error.message);
|
|
622
|
+
//console.log(error);
|
|
623
|
+
});
|
|
591
624
|
}
|