Created
January 22, 2020 22:19
-
-
Save DrewDennison/19e1335e5ab642cc0c80b053e6c7d414 to your computer and use it in GitHub Desktop.
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
rules: | |
- id: use-default-dict | |
pattern: | | |
$DICT = {} | |
... | |
if $KEY not in $DICT: | |
... | |
$DICT[$KEY] = [] | |
... | |
$DICT[$KEY].append($ITEM) | |
message: "You should use a default dict instead of checking if the key not in the dict and setting a default" | |
languages: [python] | |
severity: ERROR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment