import re

from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY


class InferBear(LocalBear, Lint):
    executable = 'infer'
    arguments = '-npb -- javac {filename}'
    output_regex = re.compile(
        r'(.+):'
        r'(?P<line>.+): '
        r'(?P<severity>error|warning): '
        r'(?P<message>.*)')
    severity_map = {
        "error": RESULT_SEVERITY.MAJOR,
        "warning": RESULT_SEVERITY.NORMAL}
    LANGUAGES = {"Java"}
    AUTHORS = {'The coala developers'}
    AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
    LICENSE = 'AGPL-3.0'
    ASCIINEMA_URL = 'https://asciinema.org/a/1g2k0la7xo5az9t8f1v5zy66q'
    CAN_DETECT = {'Security'}

    def run(self, filename, file):
        '''
        Checks the code with ``infer``.
        '''
        return self.lint(filename)

@@ -1,15 +1,4 @@
-import re%0A%0A
 from
@@ -34,165 +34,35 @@
 Lint
- import Lint%0Afrom coalib.bears.LocalBear import LocalBear%0Afrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY%0A%0A%0Aclass InferBear(LocalBear, Lint):%0A    
+er import linter%0A%0A%0A@linter(
 exec
@@ -71,120 +71,75 @@
 able
- = 
+=
 'infer'
+,
 %0A    
-arguments = '-npb -- javac %7Bfilename%7D'%0A    output_regex = re.compile(%0A        
+    output_format='regex',%0A        output_regex=
 r'
-(
 .+
-):'%0A        r'
+:
 (?P%3C
@@ -147,25 +147,14 @@
 ine%3E
-.
+%5Cd
 +): 
-'%0A        r'
 (?P%3C
@@ -180,16 +180,29 @@
 ing): '%0A
+             
         
@@ -225,111 +225,76 @@
 )')%0A
-    severity_map = %7B%0A        %22error%22: RESULT_SEVERITY.MAJOR,%0A        %22warning%22: RESULT_SEVERITY.NORMAL%7D
+class InferBear:%0A    %22%22%22%0A    Checks the code with %60%60infer%60%60.%0A    %22%22%22
 %0A   
@@ -544,134 +544,121 @@
     
-def run(self, filename, file):%0A        '''%0A        Checks the code with %60%60infer%60%60.%0A        '''%0A        return self.lint(
+@staticmethod%0A    def create_arguments(filename, file, config_file):%0A        return '-npb', '--', 'javac', 
 filename
 )%0A
@@ -655,10 +655,9 @@
 filename
-)
 %0A

Refactor to Linter v2 API