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