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

chore: run the ruff format and pyupgrade tools #633

Merged
merged 2 commits into from
Aug 26, 2024
Merged

Conversation

agriyakhetarpal
Copy link
Collaborator

@agriyakhetarpal agriyakhetarpal commented Aug 25, 2024

Description

In this PR, I have performed the following changes across the codebase:

  • I ran ruff format across all our files to automatically clean them up wherever possible, and
  • I ran pyupgrade (i.e., the pyupgrade --py38-plus command) on all files to make our code adhere to Python 3.8+ syntax as applicable.

A pre-commit configuration has yet to be established, and the pre-commit.ci app has now been requested for the repository (cc: @j-towns, who can approve it for us as the admin). The app will work once it gets approved. The pre-commit configuration with some popular pre-commit hooks can be added either here or as a separate PR with more linting changes.

Hopefully, this will help with some of your previous remarks about the tidiness of the code, @fjosw 😄

Copy link
Collaborator

@fjosw fjosw left a comment

Choose a reason for hiding this comment

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

Hey @agriyakhetarpal, looks good to me and should certainly help with readability of the code, thanks!

@agriyakhetarpal agriyakhetarpal merged commit 03b7ac8 into master Aug 26, 2024
18 checks passed
@agriyakhetarpal agriyakhetarpal deleted the chore/linting branch August 26, 2024 07:43
agriyakhetarpal added a commit that referenced this pull request Aug 30, 2024
Continuing from #633, this PR adds support for the `pre-commit` via its
configuration file, which works with https://pre-commit.ci.
- I have suppressed all failing rules to get `pre-commit` passing in
68e3dda, so that we can fix them all
later.
- At most, the style changes in this PR are the imports that have been
tidied up and sorted using the `ruff check . --select I --fix && ruff
format .` command.
- The pre-commit config configuration file was added

Additionally, to automatically enable `pre-commit` as a Git hook
locally, type:

```bash
pip install pre-commit
pre-commit install
```

and subsequently, it would not allow creating commits that fail the
style rules we have set in `pyproject.toml` or those in
`.pre-commit-config.yaml`.
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.

2 participants