From b7d71267b7862e944823f31c2860ac9819480534 Mon Sep 17 00:00:00 2001 From: Fransiskus Febryan Date: Mon, 5 Nov 2018 12:26:31 +0700 Subject: [PATCH] GixyBear.py: Add GixyBear This commit adds GixyBear. Closes https://github.com/coala/coala-bears/issues/1724 --- bears/general/GixyBear.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 bears/general/GixyBear.py diff --git a/bears/general/GixyBear.py b/bears/general/GixyBear.py new file mode 100644 index 0000000000..38b2d14773 --- /dev/null +++ b/bears/general/GixyBear.py @@ -0,0 +1,23 @@ +from coalib.bearlib.abstractions.Linter import linter +from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY +from coalib.results.Result import Result +import json + + +@linter(executable='gixy') +class GixyBear: + severity_map = {"HIGH": RESULT_SEVERITY.MAJOR, + "MEDIUM": RESULT_SEVERITY.NORMAL, + "LOW": RESULT_SEVERITY.INFO} + + @staticmethod + def create_arguments(filename, file, config_file): + return ("--format=json", filename) + def process_output(self, output, filename, file): + output = json.loads(output) if output else [] + for issue in output: + yield Result.from_values(origin=issue["plugin"], + message=issue['description'], + additional_info=issue['reference'], + severity=self.severity_map[issue["severity"]], + file=filename)