Skip to content

Commit

Permalink
[MegaLinter] Apply linters fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam authored and github-actions[bot] committed Mar 6, 2023
1 parent 03bf31f commit b6a727b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
3 changes: 2 additions & 1 deletion mega-linter-runner/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ module.exports = optionator({
alias: "z",
type: "String",
default: "linux/amd64",
description: "Force a docker image platform (currently, only linux/amd64 works)",
description:
"Force a docker image platform (currently, only linux/amd64 works)",
},
{
option: "debug",
Expand Down
40 changes: 22 additions & 18 deletions mega-linter-runner/lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ class MegaLinterRunner {
(options.flavor === "all" || options.flavor == null) && this.isv4(release)
? "nvuillam/mega-linter"
: options.flavor !== "all" && this.isv4(release)
? `nvuillam/mega-linter-${options.flavor}`
: // << v4 retrocompatibility
// v5 retrocompatibility >>
(options.flavor === "all" || options.flavor == null) &&
this.isv5(release)
? "megalinter/megalinter"
: options.flavor !== "all" && this.isv5(release)
? `megalinter/megalinter-${options.flavor}`
: // << v5 retrocompatibility
options.flavor === "all" || options.flavor == null
? "oxsecurity/megalinter"
: `oxsecurity/megalinter-${options.flavor}`;
? `nvuillam/mega-linter-${options.flavor}`
: // << v4 retrocompatibility
// v5 retrocompatibility >>
(options.flavor === "all" || options.flavor == null) &&
this.isv5(release)
? "megalinter/megalinter"
: options.flavor !== "all" && this.isv5(release)
? `megalinter/megalinter-${options.flavor}`
: // << v5 retrocompatibility
options.flavor === "all" || options.flavor == null
? "oxsecurity/megalinter"
: `oxsecurity/megalinter-${options.flavor}`;
const dockerImage = options.image || `${dockerImageName}:${release}`; // Docker image can be directly sent in options

// Check for docker installation
Expand All @@ -98,12 +98,16 @@ ERROR: Docker engine has not been found on your system.
"The next runs, it will be immediate (thanks to docker cache !)"
);
const imagePlatform = options.platform || "linux/amd64";
const spawnResPull = spawnSync("docker", ["pull", "--platform", imagePlatform, dockerImage], {
detached: false,
stdio: "inherit",
windowsHide: true,
windowsVerbatimArguments: true,
});
const spawnResPull = spawnSync(
"docker",
["pull", "--platform", imagePlatform, dockerImage],
{
detached: false,
stdio: "inherit",
windowsHide: true,
windowsVerbatimArguments: true,
}
);
// Manage case when unable to pull docker image
if (spawnResPull.status !== 0) {
return {
Expand Down

0 comments on commit b6a727b

Please sign in to comment.