Skip to content
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

[ci] [python-package] enforce 'pylint' checks (fixes #4308) #6334

Merged
merged 4 commits into from
Feb 24, 2024

Conversation

jameslamb
Copy link
Collaborator

Fixes #4308.

Proposes enforcing the pylint set of checks, via ruff.

Fixes the following:

python-package/lightgbm/basic.py:1204:21: PLR1701 [*] Merge `isinstance` calls: `isinstance(preds, (list, scipy.sparse.spmatrix))`
python-package/lightgbm/basic.py:3095:20: PLR1701 [*] Merge `isinstance` calls
python-package/lightgbm/basic.py:3273:20: PLR1701 [*] Merge `isinstance` calls
python-package/lightgbm/plotting.py:396:22: PLW3301 Nested `max` calls can be flattened
python-package/lightgbm/plotting.py:397:22: PLW3301 Nested `min` calls can be flattened
python-package/lightgbm/plotting.py:807:16: PLR0402 [*] Use `from matplotlib import image` in lieu of alias
tests/distributed/_test_distributed.py:82:16: PLW1510 [*] `subprocess.run` without explicit `check` argument
tests/distributed/_test_distributed.py:148:18: PLW1510 [*] `subprocess.run` without explicit `check` argument

Notes for Reviewers

All the codes I added to the list of exclusions in pyproject.toml are those that I actually saw running pre-commit run --all-files with no customization, and which I think we should ignore.

For a complete list of ruff pylint rules, see https://docs.astral.sh/ruff/rules/#pylint-pl.

@jameslamb jameslamb changed the title WIP: [ci] [python-package] enforce 'pylint' checks (fixes #4308) [ci] [python-package] enforce 'pylint' checks (fixes #4308) Feb 21, 2024
@jameslamb jameslamb marked this pull request as ready for review February 21, 2024 05:01
Copy link
Collaborator

@jmoralez jmoralez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

python-package/pyproject.toml Outdated Show resolved Hide resolved
@jameslamb
Copy link
Collaborator Author

Thanks @jmoralez ! I'm hoping investing more in linting will make it easier for new contributors here.

@jameslamb jameslamb merged commit 6f19edd into master Feb 24, 2024
43 checks passed
@jameslamb jameslamb deleted the ci/pylint branch February 24, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Add pylint in CI "lint" task
2 participants