-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
InferBear: Add support for other languages
Closes #541
- Loading branch information
Showing
2 changed files
with
53 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,24 @@ class InferBear: | |
""" | ||
Checks the code with ``infer``. | ||
""" | ||
LANGUAGES = {"Java"} | ||
LANGUAGES = {"Java", "Objective-C", "C"} | ||
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
ASCIINEMA_URL = 'https://asciinema.org/a/1g2k0la7xo5az9t8f1v5zy66q' | ||
CAN_DETECT = {'Security'} | ||
|
||
@staticmethod | ||
def create_arguments(filename, file, config_file): | ||
return '-npb', '--', 'javac', filename | ||
def create_arguments(self, filename, file, config_file, language: str): | ||
""" | ||
:param language: The language to analyze (Java, Objective-C or C). | ||
""" | ||
language_args = { | ||
'java': ('javac',), | ||
'objective-c': ('clang', '-c'), | ||
'c': ('gcc', '-c') | ||
} | ||
if language not in language_args: | ||
self.err("Invalid language given! Falling back to Java.") | ||
language = 'java' | ||
|
||
return ('-npb', '--') + language_args[language.lower()] + (filename,) |
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