-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add linter for Python scripts #231
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.py
uses the global statement to accessIS_GENERATING_KRKG
andIS_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. -
import-error
:Used when pylint has been unable to import a module.
Pylint can't import
generate_tests
, since it's a local module. See here for a potential fix. -
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_tests
ingenerate_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 in
KinokoOutputValidator.validate_test_case
instatus_check.py
. -
too-few-public-methods
:Used when class has too few public methods, so be sure it's really worth it.
Occurs in the
TestCase
class 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 in
discord/bot.py
(incommand_generate_krkg
andcommand_replay_ghost
). I don't think it's necessary to fail the action from TODO comments, so I disabled this message.
Fixes #64.