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

Run unicode prefix rule over tokens #8709

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Run unicode prefix rule over tokens #8709

merged 1 commit into from
Nov 16, 2023

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Nov 16, 2023

Summary

It seems like the range of an ExprStringLiteral can be somewhat unreliable when the string is part of an implicit concatenation with an f-string. Using the tokens themselves is more reliable.

Closes #8680.
Closes #7784.

@charliermarsh charliermarsh added the bug Something isn't working label Nov 16, 2023
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this fixes #7784 as well and the new node can bring this back to the AST checker.

Copy link
Contributor

github-actions bot commented Nov 16, 2023

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+77 -0 violations, +0 -0 fixes in 41 projects)

demisto/content (+77 -0 violations, +0 -0 fixes)

+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1033:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1034:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1035:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1036:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1037:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1038:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1039:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1049:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1050:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1051:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1052:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1053:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1054:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1055:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1078:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1079:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1080:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1081:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1082:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1083:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1084:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1085:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1235:62: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:527:73: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:528:73: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:384:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:385:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:386:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:387:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:388:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:389:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:390:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:400:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:401:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:402:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:403:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:404:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:405:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:406:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:429:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:430:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:431:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:432:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:433:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:434:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:435:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:436:16: UP025 [*] Remove unicode literals from strings
+ Packs/Gmail/Integrations/Gmail/Gmail_test.py:18:27: UP025 [*] Remove unicode literals from strings
+ Packs/Gmail/Integrations/Gmail/Gmail_test.py:94:22: UP025 [*] Remove unicode literals from strings
+ Packs/GmailSingleUser/Integrations/GmailSingleUser/GmailSingleUser_test.py:105:22: UP025 [*] Remove unicode literals from strings
... 27 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
UP025 77 77 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+77 -0 violations, +0 -0 fixes in 41 projects)

demisto/content (+77 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1033:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1034:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1035:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1036:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1037:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1038:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1039:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1049:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1050:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1051:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1052:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1053:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1054:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1055:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1078:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1079:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1080:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1081:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1082:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1083:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1084:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1085:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:1235:62: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:527:73: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFiles/ParseEmailFiles_test.py:528:73: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:384:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:385:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:386:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:387:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:388:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:389:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:390:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:400:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:401:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:402:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:403:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:404:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:405:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:406:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:429:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:430:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:431:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:432:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:433:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:434:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:435:16: UP025 [*] Remove unicode literals from strings
+ Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2_test.py:436:16: UP025 [*] Remove unicode literals from strings
+ Packs/Gmail/Integrations/Gmail/Gmail_test.py:18:27: UP025 [*] Remove unicode literals from strings
+ Packs/Gmail/Integrations/Gmail/Gmail_test.py:94:22: UP025 [*] Remove unicode literals from strings
+ Packs/GmailSingleUser/Integrations/GmailSingleUser/GmailSingleUser_test.py:105:22: UP025 [*] Remove unicode literals from strings
... 27 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
UP025 77 77 0 0 0

@charliermarsh charliermarsh merged commit cd29761 into main Nov 16, 2023
16 checks passed
@charliermarsh charliermarsh deleted the charlie/panci branch November 16, 2023 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule UP025 cause panic Invalid fix for UP025 when implicitly concatenated with f-string
2 participants