Open
Description
Certain rules which look at f-strings, especially implicitly concatenated ones, performs the check for an individual string element and not the concatenated one. Taking https://docs.astral.sh/ruff/rules/hardcoded-bind-all-interfaces/ as an example,
# We don't highlight this but we used to before the implicit string concatenation refactor
'0.0.' f'0.0{expr}'
# We highlight the ones marked by `^`
'0.0.0.0' f'0.0.0.0{expr}0.0.0.0'
# ^^^^^^^ ^^^^^^^
This is different for strings which are implicitly concatenated. For example,
src/S.py:2:1: S104 Possible binding to all interfaces
|
1 | '0.0.0.0' f'0.0.0.0{expr}0.0.0.0'
2 | '0.0.' '0.0'
| ^^^^^^^^^^^^ S104
|
The reason we used to highlight the first example before the string refactor is that we would normalize the implicitly concatenated f-strings. So, the above example would become f"0.0.0.0{expr}"
.
We should add some logic to get the concatenated strings for an implicitly concatenated f-string.