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

Add precommit for linting and formatting #9123

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

kdaily
Copy link
Member

@kdaily kdaily commented Dec 5, 2024

Description of changes:

First in a series of commits to lint and format the v2 branch of this repository.

Adds a precommit hook configuration file and enables whitespace linting, isort for imports, and ruff to lint and format. It adds configuration to pyproject.toml for ruff as well with the same configuration as the develop branch, with the exception of ignoring unused imports (F401). This exception will be dropped at a later date.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kdaily kdaily force-pushed the kdaily-add-precommit-hook branch 6 times, most recently from 85393a5 to f932015 Compare December 6, 2024 19:02
@kdaily kdaily force-pushed the kdaily-add-precommit-hook branch 4 times, most recently from 0fb1fd7 to 6156454 Compare December 17, 2024 21:26
@kdaily kdaily marked this pull request as ready for review December 19, 2024 18:05
@kdaily kdaily requested a review from a team December 19, 2024 18:05
First pass at adding a pre-commit hook to enforce
formatting and linting standards.

This adds the pre-commit command to run on a
limited set of directories. Subsequent changes
will remove excluded folders and run formatting on
them as well.

The command will use the standard pre-commit hooks
for yaml, whitespace, and end of line linting.

It also uses `ruff` configured identically to
the develop branch, except for disabling
unused import checks ("F401"), as there are known
imports that are unused in the module but imported
in other modules. This is common in `compat` but
in other places as well.

It also uses `isort`, also configured identically
to the develop branch.

The intention is to start enforcing formatting and
linting standards on edited code. Running the
pre-commit hook manually will make numerous
changes that should be broken into multiple
phases. Additional PRs will work to get the
codebase up-to-date passing all standards.
@kdaily kdaily force-pushed the kdaily-add-precommit-hook branch from 6156454 to 46cb394 Compare December 24, 2024 19:11
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.

1 participant