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

SWAP flake8-gettext (INT) #16735

Closed
p1-dta opened this issue Mar 14, 2025 · 6 comments · Fixed by #16769
Closed

SWAP flake8-gettext (INT) #16735

p1-dta opened this issue Mar 14, 2025 · 6 comments · Fixed by #16769
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@p1-dta
Copy link

p1-dta commented Mar 14, 2025

Summary

Two rules documentation seems to be swapped:

Expected detection:

  • INT002: _("Hello, {}!".format(name)) # Looks for "Hello, Maria!".
  • INT003: _("Hello, %s!" % name) # Looks for "Hello, Maria!".

Actual documentation:

  • INT002: _("Hello, %s!" % name) # Looks for "Hello, Maria!".
  • INT003: _("Hello, {}!".format(name)) # Looks for "Hello, Maria!".

I wonder if this is intended.

I didn't checked if the rule INT002 actually detect str.format or printf style, but in any case, there is an inconsistency somewhere.

@ntBre
Copy link
Contributor

ntBre commented Mar 14, 2025

Nice catch! If I'm parsing the results on the playground right, it looks like the examples in the documentation are swapped and the implementations are correct.

@ntBre ntBre added the documentation Improvements or additions to documentation label Mar 14, 2025
@MichaReiser
Copy link
Member

@p1-dta are you interested in PRing a fix or @ntBre, are you already working on it?

@ntBre
Copy link
Contributor

ntBre commented Mar 14, 2025

I haven't started working on it. @p1-dta feel free to go ahead if you're interested, or we can put the help wanted label on.

I am happy to work on it if nobody else does, though.

@MichaReiser
Copy link
Member

I think this is bad enough that we should fix it ourselves, unless @p1-dta is interested

@ntBre
Copy link
Contributor

ntBre commented Mar 14, 2025

I'll keep it in my inbox and check back later today.

@ntBre ntBre self-assigned this Mar 14, 2025
ntBre added a commit that referenced this issue Mar 15, 2025
examples (`INT002`, `INT003`)

Summary
--

Fixes #16735.

Test Plan
--
None
ntBre added a commit that referenced this issue Mar 17, 2025
…examples (`INT002`, `INT003`) (#16769)

Summary
--
Fixes #16735. I also checked `INT001`, and it correctly has an f-string
example.

Test Plan
--
None
@p1-dta
Copy link
Author

p1-dta commented Mar 19, 2025

Hi, I'm back, sorry for being late, I don't use GH on a daily basis, so I missed the notification.
I not looking for PRing if someone else have the time to tackle it.
Thanks for fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
3 participants