Skip to content

Ruff formatter and Pre commit#1602

Open
FallenDeity wants to merge 11 commits into
PokeAPI:masterfrom
FallenDeity:ruff-formatting
Open

Ruff formatter and Pre commit#1602
FallenDeity wants to merge 11 commits into
PokeAPI:masterfrom
FallenDeity:ruff-formatting

Conversation

@FallenDeity

Copy link
Copy Markdown
Contributor

Change description

Replaced black with ruff for formatting and also added pre-commit for enforcing consistency (locally and via circle ci) across files for formatting and linting

Most changes are just formatting changes in terms of trailing whitespace/newline, which is enforced by pre-commit now and few other hooks

- repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.3.0
    hooks:
      - id: check-ast
      - id: check-json
      - id: check-toml
      - id: check-yaml
        args:
          - --allow-multiple-documents
      - id: end-of-file-fixer
      - id: fix-byte-order-marker
      - id: pretty-format-json
        args:
          - --no-sort-keys
          - --no-ensure-ascii
      - id: sort-simple-yaml
      - id: trailing-whitespace
        args:
          - --markdown-linebreak-ext=md

cc: @phalt @Naramsim

AI coding assistance disclosure

None

Contributor check list

  • I have written a description of the contribution and explained its motivation.
  • I have written tests for my code changes (if applicable).
  • I have read and understood the AI Assisted Contribution guidelines.
  • I will own this change in production, and I am prepared to fix any bugs caused by my code change.

@FallenDeity FallenDeity marked this pull request as ready for review July 12, 2026 10:29
@FallenDeity

Copy link
Copy Markdown
Contributor Author

also regarding coverage i noticed its not being used anywhere should i add coverage report generation with the tests or remove it from pyproject

Comment thread Makefile
install-base: check-uv # Install minimal requirements for runtime/pipeline environments
uv sync --locked --no-dev

pre-commit-install: check-uv # Install pre-commit hooks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we get rid of this target? isn't pre-commit installed along the other dependencies?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that dosent install pre-commit the dependency but pre-commit the hook so whenever you next run git commit the pre commit checks defined in the config file automatically run

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah, got it! Ok, so, I don't want the hook on git. Or maybe to have it more complicated I'd like to have it only when uv is installed. I don't want to force everyone to install uv. If a contributor needs to submit a small PR not touching the python logic I'd like not to force the contributor to install all the necessary tools (python, uv, deps)

@jemarq04 @phalt what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

but arent both make install and make pre-commit-install optional like you decide whether to run it or not, although I get your point once the hooks are installed you need to run pre-commit uninstall to remove them if you want to in your next minor change or commit with --no-verify flag to skip the hooks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think forcing pre-commit on everyone is a difficult sell.

But if we can have an optional path of using pre-commit with git, that is good with me :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh yeah, I skipped the part that one should enable those precommits with make pre-commit-install

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.

3 participants