Skip to content

Conversation

ParagEkbote
Copy link
Contributor

Fixes #1109

As described in the issue, I've setup pre-commit with black+isort+flake8 configuration. I've also added radon as a seperate checker from pre-commit for cyclomatic complexity and to help maintain readability as well. The current rating is A(2.5044124477473293) which is really good, so no major action needs to be taken for now.

For the pre-commit hooks, the following formatters/linters are setup:

  1. black: It auto-formats code to a strict, consistent style.

  2. flake8: It lints for style, formatting, and some basic code quality issues.

  3. isort: It automatically sorts imports by PEP8 standards and custom rules.

After executing pre-commit run --all-files, it modified 70+ files with changes, so I decided to not include the changes in this PR for now.

Could you please review?

cc: @BenjaminBossan

@githubnemo
Copy link
Collaborator

As mentioned by @BenjaminBossan in #1109, I think we'll need to tune the tools beforehand to minimize the diff. For example, black can be made a little bit more friendly to existing code style to minimize the diff substantially (as an example: disabling quote conversion).

So let's not rush this and take a little time for evaluation to minimize the impact on the versioning history :)

@ParagEkbote
Copy link
Contributor Author

ParagEkbote commented Jul 8, 2025

As mentioned by @BenjaminBossan in #1109, I think we'll need to tune the tools beforehand to minimize the diff. For example, black can be made a little bit more friendly to existing code style to minimize the diff substantially (as an example: disabling quote conversion).

So let's not rush this and take a little time for evaluation to minimize the impact on the versioning history :)

As previously discussed, I had suggested a library known as darker which can help to reduce the diff substantially by linting the codebase gradually. But feel free to let me know if you have any other approach as well.

@BenjaminBossan
Copy link
Collaborator

As previously discussed, I had suggested a library known as darker which can help to reduce the diff substantially by linting the codebase gradually. But feel free to let me know if you have any other approach as well.

I would first suggest to create a (draft) PR with black or ruff enabled and some reasonable settings to reduce the diff (most notably --skip-string-normalization) and see how big the diff is. Perhaps a gradual approach will not be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup Pre-Commit Hooks for Linting and Auto-formatting
3 participants