This commit is contained in:
2024-04-24 17:53:21 +02:00
parent 23405a43c3
commit c21c7c5b73
6 changed files with 435 additions and 92 deletions

View File

@@ -44,7 +44,7 @@ def load_config(root_dir, ci_root_dir):
"""Load the configuration from the configuration directory."""
ret = {
"files": [],
"languages": ["markdown", "docker", "rust", "shell", "python", "yaml", "js"],
"languages": ["markdown", "docker", "rust", "shell", "python", "yaml", "js", "make"],
"markdown": {"extentions": ["md"]},
"docker": {"extentions": ["Dockerfile"]},
"rust": {"extentions": ["rs"]},
@@ -64,6 +64,10 @@ def load_config(root_dir, ci_root_dir):
"extentions": ["ts", "js"],
"files": ["package.json", "yarn.lock", "schema.prisma"],
},
"make": {
"files": ["Makefile"],
"checkmake-args": []
},
}
if not os.path.isdir(ci_root_dir):
return ret
@@ -226,6 +230,11 @@ def get_results(config, files, root_dir):
if "shellcheck-args" in config["shell"]
else []
),
"checkmake-args": (
config["make"]["checkmake-args"]
if "checkmake-args" in config["make"]
else []
),
"black-args": (
config["python"]["black-args"] if "black-args" in config["python"] else []
),
@@ -245,6 +254,12 @@ def get_results(config, files, root_dir):
if "sh" in files:
append_stage(stages, "lint", "lint-shell", config["files"])
args["shellcheck-args"].extend(files["sh"])
if "sh" in files:
append_stage(stages, "lint", "lint-shell", config["files"])
args["shellcheck-args"].extend(files["sh"])
if "Makefile" in files:
append_stage(stages, "lint", "lint-make", config["files"])
args["checkmake-args"].extend(files["Makefile"])
if "rs" in files:
append_stage(stages, "lint", "lint-clippy", config["files"])
if "py" in files:
@@ -282,5 +297,6 @@ save_json(
get_images_name(files["Dockerfile"] if "Dockerfile" in files else [], root),
)
save_json("$(results.shellcheck-args.path)", args["shellcheck-args"])
save_json("$(results.checkmake-args.path)", args["checkmake-args"])
save_json("$(results.black-args.path)", args["black-args"])
save_json("$(results.pylint-args.path)", args["pylint-args"])