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

Rename to flake8 async #206

Merged
merged 6 commits into from
Feb 26, 2024
Merged

Conversation

jakkdl
Copy link
Member

@jakkdl jakkdl commented Feb 23, 2024

First steps in renaming the project:

  1. Update documentation to refer to flake8-async instead of flake8-trio
  2. Add name history to readme, expand it a bit in general.
  3. rename the executable

In the second commit I rename all the error codes.
This was largely done with a search&replace of TRIO->ASYNC across all files, and then cleaning up the mess.

  • several places assumed the length of the error code to be 7, which is now incorrect. (This is to turn e.g. TRIO103_anyio/TRIO103_trio into the actual error code. The _anyio/_trio is to generate different suggestion depending on which library you're using.)
    • The number 8 is now saved in a constant, or we use re.match, to avoid the magic number.

Third commit renames Flake8TrioVisitor to Flake8AsyncVisitor

Review the commits separately to maybe retain some sanity. I think the tests should be thorough enough to pick up anything problematic though, so don't think we have to review this super thoroughly.

Remaining steps:

  • rename the repository to python-trio/flake8-async
    • update URL's. (I updated some to point to python-trio/flake8-trio instead of ZacHD/flake8-trio)
  • Rename files/directories. I'll do this in a separate commit, maybe even a separate PR, once the content of files has been updated, since github fails to diff the content of a file if it's renamed in the same commit
    • Rename the eval & autofix files, removing the temporary renaming functions.
    • rename the flake8_trio directory, the flake8_trio/visitors/flake8triovisitor.py file, and the tests/test_flake8_trio.py file.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Probably want to rebase on main to get the TRIO117 removal. Overall looks great, and future rounds of review should be quicker with the "Viewed" status set for most files...

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
flake8_trio/visitors/flake8triovisitor.py Outdated Show resolved Hide resolved
setup.py Show resolved Hide resolved
tests/autofix_files/noqa.py.diff Show resolved Hide resolved
# TRIOxxx_* are fake codes to get different error messages for the same code
IGNORED_CODES_REGEX = r"TRIO107|TRIO108|TRIO\d\d\d_.*"
# ASYNCxxx_* are fake codes to get different error messages for the same code
IGNORED_CODES_REGEX = r"(TRIO|ASYNC)107|(TRIO|ASYNC)108|ASYNC\d\d\d_.*"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
IGNORED_CODES_REGEX = r"(TRIO|ASYNC)107|(TRIO|ASYNC)108|ASYNC\d\d\d_.*"
IGNORED_CODES_REGEX = r"(TRIO|ASYNC)10[78]|ASYNC\d\d\d_.+"

I think this is net easier to read now

@jakkdl jakkdl requested a review from Zac-HD February 25, 2024 14:20
Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

LGTM with one nit about a print(), merge when ready 🎉

And after that I'll update the PyPI token, bump version, and release under flake8-async! (and once we've seen everything working smoothly for a while, I'll make a final placeholder/depender release under flake8-trio)

# TRIOxxx_* are fake codes to get different error messages for the same code
IGNORED_CODES_REGEX = r"TRIO107|TRIO108|TRIO117|TRIO\d\d\d_.*"
# ASYNCxxx_* are fake codes to get different error messages for the same code
IGNORED_CODES_REGEX = r"(TRIO|ASYNC)(107|108|117)|ASYNC\d\d\d_.*"
Copy link
Member

Choose a reason for hiding this comment

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

Much nicer than my proposal 👍

for error_msg in re.findall(r"TRIO\d\d\d", line):
documented_errors[filename].add(error_msg)
for error_msg in re.findall(r"TRIO\d\d\d|ASYNC\d\d\d", line):
print(error_msg, rename_trio_to_async(error_msg))
Copy link
Member

Choose a reason for hiding this comment

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

Stray print()?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, removed.

@jakkdl jakkdl merged commit 7748d40 into python-trio:main Feb 26, 2024
8 checks passed
@jakkdl jakkdl deleted the rename_to_flake8_async branch February 26, 2024 14:06
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