-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary This PR updates the implicit string concatenation rules, specifically `ISC001` and `ISC002` to account for the new f-string tokens. `ISC003` checks for explicit string concatenation and is not affected by PEP 701 because it is based on AST. ### Implementation The implementation is based on the boundary tokens of the f-string which are `FStringStart` and `FStringEnd`. There are 4 cases to look for: 1. `String` followed by `FStringStart` 2. `FStringEnd` followed by `String` 3. `FStringEnd` followed by `FStringStart` 4. `String` followed by `String` For f-string tokens, we use the `Indexer` to get the entire range of the f-string. This is the range of the innermost f-string. ## Test Plan Add new test cases for nested f-strings.
- Loading branch information
1 parent
fb63fad
commit d664e9f
Showing
9 changed files
with
420 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,7 @@ pub(crate) fn check_tokens( | |
tokens, | ||
&settings.flake8_implicit_str_concat, | ||
locator, | ||
indexer, | ||
); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.