-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 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,25 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Use Clippy to lint rust files | ||
""" | ||
import logging | ||
import os | ||
|
||
import megalinter | ||
|
||
|
||
class ClippyLinter(megalinter.Linter): | ||
|
||
# To execute before linting files | ||
def before_lint_files(self): | ||
# Build pre-command | ||
if not os.path.isfile(os.path.expandvars("${HOME}/.rustup/settings.toml")): | ||
rustup_init_command = "rustup default stable" | ||
if self.pre_commands is None: | ||
self.pre_commands = [] | ||
# Add to pre-commands | ||
logging.debug("clippy before_lint_files: " + rustup_init_command) | ||
self.pre_commands.append({ | ||
"command": rustup_init_command, | ||
"cwd": self.workspace | ||
}) |