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

Removing trailing whitespace inside multiline strings is unsafe #9744

Conversation

sanxiyn
Copy link
Contributor

@sanxiyn sanxiyn commented Jan 31, 2024

Fix #8037.

@@ -0,0 +1,2 @@
'''trailing whitespace
inside a multiline string'''
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind adding a test for a multi-line f-string here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a test and it failed! From a brief look, it didn't seem trivial, and I would prefer to do this as a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@charliermarsh charliermarsh added the bug Something isn't working label Jan 31, 2024
Copy link
Contributor

github-actions bot commented Jan 31, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -0 violations, +0 -20 fixes in 2 projects; 41 projects unchanged)

latchbio/latch (+0 -0 violations, +0 -8 fixes)

+ latch/resources/map_tasks.py:2:60: W291 Trailing whitespace
- latch/resources/map_tasks.py:2:60: W291 [*] Trailing whitespace
+ latch/resources/map_tasks.py:3:61: W291 Trailing whitespace
- latch/resources/map_tasks.py:3:61: W291 [*] Trailing whitespace
+ latch/resources/map_tasks.py:4:60: W291 Trailing whitespace
- latch/resources/map_tasks.py:4:60: W291 [*] Trailing whitespace
+ latch/resources/map_tasks.py:5:58: W291 Trailing whitespace
- latch/resources/map_tasks.py:5:58: W291 [*] Trailing whitespace

reflex-dev/reflex (+0 -0 violations, +0 -12 fixes)

+ reflex/.templates/apps/demo/code/pages/datatable.py:204:140: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:204:140: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/datatable.py:205:156: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:205:156: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/datatable.py:206:128: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:206:128: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/datatable.py:207:100: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:207:100: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/forms.py:21:32: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/forms.py:21:32: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/forms.py:22:39: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/forms.py:22:39: W291 [*] Trailing whitespace

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
W291 20 0 0 0 20

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -0 violations, +0 -20 fixes in 2 projects; 41 projects unchanged)

latchbio/latch (+0 -0 violations, +0 -8 fixes)

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

+ latch/resources/map_tasks.py:2:60: W291 Trailing whitespace
- latch/resources/map_tasks.py:2:60: W291 [*] Trailing whitespace
+ latch/resources/map_tasks.py:3:61: W291 Trailing whitespace
- latch/resources/map_tasks.py:3:61: W291 [*] Trailing whitespace
+ latch/resources/map_tasks.py:4:60: W291 Trailing whitespace
- latch/resources/map_tasks.py:4:60: W291 [*] Trailing whitespace
+ latch/resources/map_tasks.py:5:58: W291 Trailing whitespace
- latch/resources/map_tasks.py:5:58: W291 [*] Trailing whitespace

reflex-dev/reflex (+0 -0 violations, +0 -12 fixes)

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

+ reflex/.templates/apps/demo/code/pages/datatable.py:204:140: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:204:140: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/datatable.py:205:156: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:205:156: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/datatable.py:206:128: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:206:128: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/datatable.py:207:100: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/datatable.py:207:100: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/forms.py:21:32: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/forms.py:21:32: W291 [*] Trailing whitespace
+ reflex/.templates/apps/demo/code/pages/forms.py:22:39: W291 Trailing whitespace
- reflex/.templates/apps/demo/code/pages/forms.py:22:39: W291 [*] Trailing whitespace

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
W291 20 0 0 0 20

Formatter (stable)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

warning: Detected debug build without --no-cache.
error: Failed to parse examples/dalle/Image_generations_edits_and_variations_with_DALL-E.ipynb:3:7:8: Unexpected token 'prompt'

Formatter (preview)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Failed to parse examples/dalle/Image_generations_edits_and_variations_with_DALL-E.ipynb:3:7:8: Unexpected token 'prompt'

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thanks!

@charliermarsh charliermarsh enabled auto-merge (squash) January 31, 2024 21:39
@charliermarsh charliermarsh merged commit 6e225cb into astral-sh:main Jan 31, 2024
16 checks passed
@sanxiyn sanxiyn deleted the trailing-whitespace-inside-multiline-string branch January 31, 2024 21:47
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.

W291: ruff --fix removes trailing whitespace in multiline string
2 participants