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


class JuliaLintBear(LocalBear, Lint):
    executable = 'julia'
    arguments = '-e \'import Lint.lintfile; lintfile("{filename}")\''
    prerequisite_command = ['julia', '-e', 'import Lint.lintfile']
    prerequisite_fail_msg = 'Run `Pkg.add("Lint")` from Julia to install Lint.'
    output_regex = r'(^.*\.jl):(?P<line>\d+) (?P<severity>.)\d+ (?P<message>.*)'
    use_stdout = True
    severity_map = {
        "E": RESULT_SEVERITY.MAJOR,
        "W": RESULT_SEVERITY.NORMAL,
        "I": RESULT_SEVERITY.INFO
    }

    def run(self, filename, file):
        '''
        Lints Julia code using ``Lint.jl``.
        https://github.com/tonyhffong/Lint.jl
        '''
        return self.lint(filename, file)

@@ -9,41 +9,40 @@
 lib.
-bearlib.abstractions.Lint
+parsing.StringProcessing
  import 
 Lint
@@ -37,20 +37,23 @@
  import 
-Lint
+escape%0A
 %0Afrom co
@@ -65,18 +65,30 @@
 bear
-s.LocalBea
+lib.abstractions.Linte
 r im
@@ -92,24 +92,21 @@
  import 
-LocalBea
+linte
 r%0Afrom c
@@ -164,50 +164,16 @@
 Y%0A%0A%0A
-class JuliaLintBear(LocalBear, Lint):%0A    
+@linter(
 exec
@@ -182,236 +182,53 @@
 able
- = 
+=
 'julia'
+,
 %0A    
-arguments = '-e %5C'import Lint.lintfile; lintfile(%22%7Bfilename%7D%22)%5C''%0A    prerequisite_command = %5B'julia', '-e', 'import Lint.lintfile'%5D%0A    prerequisite_fail_msg = 'Run %60Pkg.add(%22Lint%22)%60 from Julia to install Lint.'%0A
+    output_format='regex',%0A    
     
@@ -243,22 +243,13 @@
 egex
- = r'(%5E.*%5C.jl)
+=r'.+
 :(?P
@@ -298,35 +298,18 @@
 .*)'
+,
 %0A    
-use_stdout = True%0A
+ 
    
- 
 seve
@@ -320,24 +320,13 @@
 _map
- = %7B%0A        %22E%22
+=%7B'E'
 : RE
@@ -358,11 +358,25 @@
     
-%22W%22
+              'W'
 : RE
@@ -409,11 +409,25 @@
     
-%22I%22
+              'I'
 : RE
@@ -448,71 +448,327 @@
 INFO
+%7D,
 %0A    
-%7D%0A%0A
     
-def run(self, filename, file):%0A        '''%0A     
+prerequisite_check_command=('julia', '-e', 'import Lint.lintfile'),%0A        prerequisite_check_fail_message='Lint package not installed. Run '%0A                                        '%60Pkg.add(%22Lint%22)%60 from Julia to '%0A                                        'install Lint.')%0Aclass JuliaLintBear:%0A    %22%22%22%0A
    
+ 
 Lint
@@ -799,20 +799,16 @@
 t.jl%60%60.%0A
-    
     http
@@ -849,53 +849,221 @@
     
-    '''%0A        return self.lint(filename, file)
+%22%22%22%0A%0A    @staticmethod%0A    def create_arguments(filename, file, config_file):%0A        lintcode = ('import Lint.lintfile; lintfile(%22' +%0A                    escape(filename, '%22%5C%5C') + '%22)')%0A        return '-e', lintcode
 %0A

Refactor to Linter v2 API