forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linting for Julia using Lint.jl https://github.com/tonyhffong/Lint.jl Fixes coala#23
- Loading branch information
Showing
6 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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})\'' | ||
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) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from bears.julia.JuliaLintBear import JuliaLintBear | ||
from tests.LocalBearTestHelper import verify_local_bear | ||
|
||
good_file = """ | ||
a = 2 | ||
println(2) | ||
""".splitlines(keepends=True) | ||
|
||
bad_file = """ | ||
println(hello) | ||
""".splitlines(keepends=True) | ||
|
||
JuliaLintBearTest = verify_local_bear(JuliaLintBear, | ||
valid_files=(good_file,), | ||
invalid_files=(bad_file,), | ||
tempfile_kwargs={"suffix": ".jl"}, | ||
timeout=45) |
Empty file.