Total Complexity | 5 |
Total Lines | 26 |
Duplicated Lines | 0 % |
1 | import json |
||
9 | class DockerfileLintBear(LocalBear, Lint): |
||
10 | executable = 'dockerfile_lint' |
||
11 | arguments = '--json -f' |
||
12 | severity_map = { |
||
13 | "error": RESULT_SEVERITY.MAJOR, |
||
14 | "warn": RESULT_SEVERITY.NORMAL, |
||
15 | "info": RESULT_SEVERITY.INFO} |
||
16 | |||
17 | def run(self, filename, file): |
||
18 | ''' |
||
19 | Checks the given file with dockerfile_lint. |
||
20 | ''' |
||
21 | return self.lint(filename) |
||
22 | |||
23 | def _process_issues(self, output, filename, file): |
||
24 | output = json.loads("".join(output)) |
||
25 | for severity in output: |
||
26 | if severity == "summary": |
||
27 | continue |
||
28 | for issue in output[severity]["data"]: |
||
29 | yield Result.from_values( |
||
30 | origin=self, |
||
31 | message=issue["message"], |
||
32 | file=filename, |
||
33 | severity=self.severity_map[issue["level"]], |
||
34 | line=issue["line"]) |
||
35 |