Skip to content

Rename to flake8 async - #206

Merged
jakkdl merged 6 commits into
python-trio:mainfrom
jakkdl:rename_to_flake8_async
Feb 26, 2024
Merged

jakkdl merged 6 commits into
python-trio:mainfrom
jakkdl:rename_to_flake8_async

Conversation

@jakkdl

@jakkdl jakkdl commented Feb 23, 2024

Copy link
Copy Markdown
Member

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.

@jakkdl
jakkdl force-pushed the rename_to_flake8_async branch from 04c0264 to 94810a6 Compare February 23, 2024 16:19

@Zac-HD Zac-HD left a comment

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.

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...

Comment thread README.md Resolved
Comment thread README.md Resolved
Comment thread setup.py Resolved
Comment thread tests/autofix_files/noqa.py.diff Resolved
Comment thread tests/test_messages_documented.py Outdated
# 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
Copy Markdown
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

@Zac-HD Zac-HD left a comment

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.

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
Copy Markdown
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 👍

Comment thread tests/test_messages_documented.py Outdated
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
Copy Markdown
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
Copy Markdown
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
@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