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

Enable the isort rules for ruff and fix linting issues #3698

Merged
merged 5 commits into from Jan 25, 2024
Merged

Conversation

stacimc
Copy link
Contributor

@stacimc stacimc commented Jan 24, 2024

Fixes

Fixes #3695 by @stacimc

Description

When we moved from isort to ruff, the import sorting in the pre-commit step was broken. This PR:

  • Updates pyproject.toml to enable the isort rules for ruff, which causes import sorting to begin working again in the pre-commit.
  • Fixes all linting issues with imports that were merged while the pre-commit wasn't working.

Testing Instructions

Pick any file and move the imports out of order (out of alphabetical order, change the spaces between import blocks, move local imports before third party, etc). Run just lint and verify it fails and updates the file. Verify that no other files were changed (all other fixes should be present in this PR).

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@stacimc stacimc added 🟥 priority: critical Must be addressed ASAP 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository 🧱 stack: api Related to the Django API 🧱 stack: ingestion server Related to the ingestion/data refresh server 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: mgmt Related to repo management and automations labels Jan 24, 2024
@stacimc stacimc self-assigned this Jan 24, 2024
@stacimc stacimc requested review from a team as code owners January 24, 2024 00:20
@AetherUnbound
Copy link
Contributor

Ah, it looks like we can get elasticsearch_cluster to show up properly by adding it here!

openverse/pyproject.toml

Lines 41 to 52 in ba942f2

known-first-party = [
"conf",
"api",
"ingestion_server",
"common",
"data_refresh",
"database",
"maintenance",
"oauth2",
"providers",
"retired",
]

I had forgotten that we needed to make those explicit due to how our python path is set up on Airflow 😅

Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Awesome find!!

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

Good catch, I have some additional notes. Thanks!

pyproject.toml Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@stacimc stacimc requested a review from dhruvkb January 24, 2024 20:42
@stacimc stacimc marked this pull request as draft January 24, 2024 21:34
@stacimc stacimc marked this pull request as ready for review January 24, 2024 22:24
@stacimc stacimc merged commit 9b4f727 into main Jan 25, 2024
46 checks passed
@stacimc stacimc deleted the fix/ruff-isort branch January 25, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP 🧱 stack: api Related to the Django API 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: ingestion server Related to the ingestion/data refresh server 🧱 stack: mgmt Related to repo management and automations
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Ruff failing to correctly sort imports
3 participants