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

[python-package] Lint code locally before pushing changes to remote #5142

Closed
TremaMiguel opened this issue Apr 11, 2022 · 1 comment · Fixed by #5809
Closed

[python-package] Lint code locally before pushing changes to remote #5142

TremaMiguel opened this issue Apr 11, 2022 · 1 comment · Fixed by #5809

Comments

@TremaMiguel
Copy link
Contributor

Summary

Create a Makefile that lints code locally before pushing changes to remote.

make lint-python

this will run code inside test.sh

echo "Linting Python code"
    pycodestyle --ignore=E501,W503 --exclude=./.nuget,./external_libs . || exit -1
    pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^external_libs|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1
    isort . --check-only || exit -1
    mypy --ignore-missing-imports python-package/ || true

Motivation

LightGBM contributors might wait several attempts until the ci lint stage passes correctly, with the local make command he/she lint the changes locally before submitting it to review.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues
including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants