Skip to content

fix: flag EM103 on f-string .format() receivers#88

Merged
henryiii merged 1 commit into
mainfrom
fix/em103-fstring-format
Jun 15, 2026
Merged

fix: flag EM103 on f-string .format() receivers#88
henryiii merged 1 commit into
mainfrom
fix/em103-fstring-format

Conversation

@henryiii

Copy link
Copy Markdown
Owner

🤖 AI text below 🤖

Closes item 2 of #86.

EM103 only matched .format() when the receiver was a plain string Constant, so an f-string receiver slipped through every check:

raise RuntimeError(f"{x}".format())   # previously unflagged

The pattern now also matches an ast.JoinedStr receiver, reporting it as EM103 (the construct is a direct .format() call). Added test_err2b_fstring_format. All tests pass.

EM103 only matched `.format()` on a plain string Constant, so
`raise RuntimeError(f"{x}".format())` slipped through every check. Extend
the pattern to also match a JoinedStr (f-string) receiver.

Refs #86

Assisted-by: ClaudeCode:claude-opus-4.8
@henryiii henryiii merged commit 38205e5 into main Jun 15, 2026
12 checks passed
@henryiii henryiii deleted the fix/em103-fstring-format branch June 15, 2026 23:17
@henryiii henryiii mentioned this pull request Jun 18, 2026
henryiii added a commit that referenced this pull request Jun 18, 2026
Bumping to 0.7.0 instead of 0.6.1 because the format f-string fix could
trigger a new discovery that was missed before.

---

### Fixed
- EM103 now flags `.format()` receivers on f-strings (#88) — previously
missed.
- EM106 no longer false-positives on walruses inside nested lambdas
(#87).
- Corrected plugin version reported by the plugin, dropped dead code,
and tidied error constructors (#85).

### Tests
- Added coverage for CLI paths and the string-length boundary; clarified
the `cls` comment (#89).

### Chores / CI
- Support Python 3.15 (#92)
- Support pylint 4 (#72).
- `pytest` config switched to `log_level` over `log_cli_level` (#75).
- Added an `AGENTS` file (#84).
- Bumped `setup-uv` (6→7, then to the maintained tag scheme, then
8.1.0→8.2.0), `download-artifact` (5→6), and other grouped action
updates (#90, #82, #80, #74, #71, #70).
- Several routine pre-commit hook updates (#83, #79, #77, #73, #69).

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
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.

1 participant