Skip to content
Snippets Groups Projects
Commit de35bb3f authored by nenad.petrovic@xlab.si's avatar nenad.petrovic@xlab.si Committed by Mati(ja)c Cankar
Browse files

Fixed visualization for various tools and added INFO outcome for cloc tool

parent 2f5083bd
No related branches found
No related tags found
No related merge requests found
......@@ -4,16 +4,16 @@ from typing import List
class Compatibility:
# TODO: This matrix should be revised and extended, it is just a proof of concept here as for now
compatibility_matrix = {
"terraform": ["tfsec", "tflint", "terrascan", "git-leaks", "git-secrets"],
"yaml": ["git-leaks", "yamllint", "git-secrets", "ansible-lint", "steampunk-scanner"],
"shell": ["shellcheck", "git-leaks", "git-secrets"],
"python": ["pylint", "bandit", "pyup-safety"],
#"ansible": ["ansible-lint", "steampunk-scanner"],
"java": ["checkstyle"],
"js": ["es-lint", "ts-lint"],
"html": ["htmlhint"],
"docker": ["hadolint"],
"other": ["git-leaks", "git-secrets"],
"terraform": ["tfsec", "tflint", "terrascan", "git-leaks", "git-secrets", "cloc"],
"yaml": ["git-leaks", "yamllint", "git-secrets", "ansible-lint", "steampunk-scanner", "cloc"],
"shell": ["shellcheck", "git-leaks", "git-secrets", "cloc"],
"python": ["pylint", "bandit", "pyup-safety", "cloc"],
"java": ["checkstyle", "cloc"],
"js": ["es-lint", "ts-lint", "cloc"],
"html": ["htmlhint", "cloc"],
"docker": ["hadolint", "cloc"],
"common": ["git-leaks", "git-secrets", "cloc"],
"other": []
}
def __init__(self):
......@@ -48,12 +48,13 @@ class Compatibility:
scanned_js = []
scanned_docker = []
scanned_other = []
scanned_all = []
# TODO: List of supported file types should be extended
# TODO: Remove hardcoded check names
try:
for root, folders, names in os.walk(iac_directory):
for f in names:
scanned_all.append(f)
if (f.find(".tf") > -1) or (f.find(".tftpl") > -1):
types.append("terraform")
scanned_terraform.append(f)
......@@ -90,6 +91,8 @@ class Compatibility:
types.append("other")
scanned_other.append(f)
types.append("common")
self.scanned_files["terraform"] = str(scanned_terraform)
self.scanned_files["python"] = str(scanned_py)
self.scanned_files["shell"] = str(scanned_shell)
......@@ -99,6 +102,7 @@ class Compatibility:
self.scanned_files["js"] = str(scanned_js)
self.scanned_files["docker"] = str(scanned_docker)
self.scanned_files["other"] = str(scanned_other)
self.scanned_files["common"] = str(scanned_all)
types = set(types)
......
......@@ -63,6 +63,14 @@ class ResultsSummary:
self.outcomes[check]["status"] = "Problems"
return "Problems"
elif check == "git-secrets":
if outcome=="":
self.outcomes[check]["status"] = "Passed"
return "Passed"
else:
self.outcomes[check]["status"] = "Problems"
return "Problems"
elif check == "terrascan":
if outcome == "":
self.outcomes[check]["status"] = "Passed"
......@@ -159,6 +167,10 @@ class ResultsSummary:
self.outcomes[check]["status"] = "Problems"
return "Problems"
elif check == "cloc":
self.outcomes[check]["status"] = "Info"
return "Info"
elif check == "ansible-lint":
if outcome=="":
self.outcomes[check]["status"] = "Passed"
......@@ -236,6 +248,17 @@ class ResultsSummary:
html_page = html_page + "<td>" + self.outcomes[scan]["log"] + "</td>"
html_page = html_page + "</tr>"
for scan in self.outcomes:
if self.outcomes[scan]["status"] == "Info":
html_page = html_page + "<tr>"
html_page = html_page + "<td>" + scan + "</td>"
html_page = html_page + "<td bgcolor='yellow'>" + str(self.outcomes[scan]["status"]) + "</td>"
html_page = html_page + "<td>" + self.outcomes[scan]["files"] + "</td>"
html_page = html_page + "<td>" + self.outcomes[scan]["log"] + "</td>"
html_page = html_page + "</tr>"
for scan in self.outcomes:
if self.outcomes[scan]["status"] == "No files":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment