-
Notifications
You must be signed in to change notification settings - Fork 143
[DEV-13590] - POC Add Code Quality Checks #4525
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: qat
Are you sure you want to change the base?
Conversation
| - name: install pylint | ||
| run: pip install pylint==4.0.2 | ||
| - name: pylint | ||
| run: pylint ${{ steps.changed-files.outputs.all_changed_files }} |
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.
Checks can be run on just the files changed in the PR.
| enable = [ | ||
| "too-many-instance-attributes", | ||
| "too-many-public-methods", | ||
| "too-many-return-statements", | ||
| "too-many-branches", | ||
| "too-many-arguments", | ||
| "too-many-statements", | ||
| "too-many-boolean-expressions", | ||
| "too-complex", | ||
| "too-many-lines", | ||
| "too-many-nested-blocks" | ||
| ] |
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.
Checks can be enabled in the pyproject.toml
| [tool.pylint.design] | ||
| max-args = 6 | ||
| max-public-methods = 20 | ||
| max-attributes = 10 | ||
| max-bool-expr = 8 | ||
| max-branches = 10 | ||
| max-returns = 3 | ||
| max-statements = 45 | ||
| max-complexity=10 | ||
|
|
||
|
|
||
| [tool.pylint.format] | ||
| max-module-lines = 250 | ||
|
|
||
| [tool.pylint.refactoring] | ||
| max-nested-blocks = 5 |
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.
Checks can be configured in the pyproject.toml
Description:
This is a proof of concept for adding code quality checks back into our CI/CD pipeline. We previously used CodeClimate, but that product has been discontinued. The
pylintlibrary very established library that has checks that match all of the checks that we previously used with CodeClimate and could be a good replacement for our code quality checks.This PR is a good opportunity to discuss which checks we want to have going forward. The pylint user guide includes a complete list of checks.
I included a test file to trigger a code climate check failure. You can see the failure message here.