Skip to content

Conversation

@yomcube
Copy link
Contributor

@yomcube yomcube commented Jan 2, 2025

Fixes #64.

@yomcube
Copy link
Contributor Author

yomcube commented Jan 3, 2025

  • TODO: search for files in the same way the clang-format job does

@yomcube yomcube force-pushed the pylint branch 2 times, most recently from 87c0e16 to 1255b20 Compare January 3, 2025 18:31
.pylintrc Outdated
Comment on lines 1 to 20
[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,
Copy link
Owner

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?

Copy link
Contributor Author

@yomcube yomcube Feb 28, 2025

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 access IS_GENERATING_KRKG and IS_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 import generate_tests, since it's a local module. See here for a potential fix.
    Removed; fixed by using init-hook in .pylintrc to append tools/ 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_tests in generate_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 in status_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 TestCase class in generate_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 (in command_generate_krkg and command_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.

@vabold vabold added the P4 Priority: Trivial label Jan 26, 2025
@yomcube yomcube force-pushed the pylint branch 2 times, most recently from f5444fd to be9c585 Compare March 6, 2025 13:08
@yomcube yomcube force-pushed the pylint branch 6 times, most recently from 193fcb8 to d2dcca2 Compare March 15, 2025 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P4 Priority: Trivial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add linter for Python scripts

2 participants