-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to enable/disable checks: (#41)
There is now a new "enabled" flag which can be used to skip the loading of a check unless the user explictly opts into the check. By default, all checks are enabled unless the author disables them. I only added --enable, since adding --disable will require some additional logic for parsing. Either way, --ignore does almost the same thing, but --disable would prevent the check from even being loaded, whereas --ignore only suppresses an error.
- Loading branch information
Showing
7 changed files
with
103 additions
and
8 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
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
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 dataclasses import dataclass | ||
|
||
from mypy.nodes import MypyFile | ||
|
||
from refurb.error import Error | ||
|
||
|
||
@dataclass | ||
class ErrorInfo(Error): | ||
enabled = False | ||
prefix = "XYZ" | ||
code = 999 | ||
msg: str = "This message is disabled by default" | ||
|
||
|
||
def check(node: MypyFile, errors: list[Error]) -> None: | ||
errors.append(ErrorInfo(node.line, node.column)) |
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