Skip to content

Commit

Permalink
Merge pull request #716 from SSWConsulting/upload-htmlhint-config
Browse files Browse the repository at this point in the history
Ensure all HTMLHint rules are uploaded against every scan
  • Loading branch information
tombui99 authored Oct 20, 2023
2 parents 786c639 + f50fc24 commit 54fef5d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const {
runLighthouseReport,
runArtilleryLoadTest
} = require("./utils");
const { htmlHintConfig } = require("./api");

const LIGHTHOUSEFOLDER = "./lhr.json";
const ARTILLERYFOLDER = "./artilleryOut.json";
Expand Down Expand Up @@ -315,7 +316,7 @@ const processAndUpload = async (
});
} catch (error) {
console.error(
`Error: Unabled to push data to dashboard service => ${error.message}`
`Error: Unable to push data to dashboard service => ${error.message}`
);
}
}
Expand All @@ -334,13 +335,13 @@ const processAndUpload = async (
// Upload selected HTMLHint Rules to the scan
if (args.htmlhint && args.token && runId) {
const result = await getHTMLHintRules(args.token, args.url);
const selectedRules = result?.selectedRules ?? Object.keys(htmlHintConfig).join(",");

if (result && result.selectedRules?.split(",").length > 0) {
const selectedRules = result.selectedRules;
if (selectedRules?.length > 0) {
const res = await addHTMLHintRulesForScan(args.token, args.url, runId, selectedRules)

if (res) {
console.log('Upload selected HTMLHint Rules successfully')
console.log('Uploaded selected HTMLHint Rules successfully');
} else {
throw new Error("Failed to add custom html rules for each scan");
}
Expand Down

0 comments on commit 54fef5d

Please sign in to comment.