-
Notifications
You must be signed in to change notification settings - Fork 18
Add linter for Python scripts #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
87c0e16 to
1255b20
Compare
.pylintrc
Outdated
| [MESSAGES CONTROL] | ||
| disable=raw-checker-failed, | ||
| bad-inline-option, | ||
| locally-disabled, | ||
| file-ignored, | ||
| suppressed-message, | ||
| useless-suppression, | ||
| deprecated-pragma, | ||
| use-symbolic-message-instead, | ||
| use-implicit-booleaness-not-comparison-to-string, | ||
| use-implicit-booleaness-not-comparison-to-zero, | ||
| fixme, | ||
| global-statement, | ||
| import-error, | ||
| invalid-name, | ||
| missing-class-docstring, | ||
| missing-function-docstring, | ||
| missing-module-docstring, | ||
| R, | ||
| unspecified-encoding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I get an explanation of what these options do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated file, here's the new one:
[MESSAGES CONTROL]
disable=global-statement,
import-error,
invalid-name,
missing-module-docstring,
missing-class-docstring,
missing-function-docstring,
too-many-locals,
too-many-return-statements,
too-few-public-methods,
fixme
[FORMAT]
max-line-length=100-
global-statement:Used when you use the "global" statement to update a global variable. Pylint discourages its usage. That doesn't mean you cannot use it!bot.pyuses the global statement to accessIS_GENERATING_KRKGandIS_REPLAYING_GHOST. I'm not sure what to use instead of globals, so I disabled this message. More here on why global variables are discoraged.
Removed; messages can be shown without failing the action. -
import-error:~~Used when pylint has been unable to import a module.
Pylint can't importgenerate_tests, since it's a local module. See here for a potential fix.
Removed; fixed by usinginit-hookin.pylintrcto appendtools/to the module path. -
invalid-name:Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
The checker thinks that local variables in a scope like a
if __name__ == '__main__':block are global, so it flags them wrongly. Also flags camelCase variables (e.g.rkgPath), saying they should be snake_case. -
missing-(module|class|function)-docstring:Used when a module has no docstring. Empty modules do not require a docstring.
Used when a class has no docstring. Even an empty class must have a docstring.
Used when a function or method has no docstring. Some special methods like
__init__do not require a docstring.No documentation is necessary. (See #development on Discord)
-
too-many-locals:Used when a function or method has too many local variables.
Occurs in
generate_testsingenerate_tests.py. I didn't think this was a necessary message, since it's only one over the limit (16/15). -
too-many-return-statements:Used when a function or method has too many return statement, making it hard to follow.Occurs inKinokoOutputValidator.validate_test_caseinstatus_check.py.
Removed; messages can be shown without failing the action. -
too-few-public-methods:Used when class has too few public methods, so be sure it's really worth it.
Occurs in the
TestCaseclass ingenerate_tests.py. The class doesn't need any sort of methods, so I disabled this message. -
fixme:Used when a warning note as FIXME or XXX is detected.Also detects TODO comments, like indiscord/bot.py(incommand_generate_krkgandcommand_replay_ghost). I don't think it's necessary to fail the action from TODO comments, so I disabled this message.
Removed; messages can be shown without failing the action.
f5444fd to
be9c585
Compare
193fcb8 to
d2dcca2
Compare
Fixes #64.