GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — [`flake8-executable`] Mark `EXE004` fix as unsafe by baltasarblanco · Pull Request #26033 · astral-sh/ruff Conversation
Contributor
SummaryThe fix removes the whitespace before the shebang, which can include blank lines. If a blank line separates the shebang from an encoding declaration, deleting it moves the encoding up to line 2. Python then reads it following PEP 263 and changes how the file is decoded. In short, it changes the behavior. For this reason, the fix should not be marked as safe. @MichaReiser confirmed this in the thread. Fixes #15581 Test Plan
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we only mark it unsafe when the leading whitespace contains a newline? That sounded like the problem to me in the issue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Good call, done. Now it's only marked unsafe when the leading whitespace contains a newline. Thank you! @ntBre |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks for the review! Addressed all the comments in the latest push:
On the PEP 263 regex: I kept the conservative approach for now since it's niche, as you mentioned — happy to follow up with the narrower check if you'd prefer. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks this looks good now! Just one more nit about using an existing helper method. There are also some merge conflicts. Would you mind resolving those too? You probably just need to rerun the test and accept the new snapshot.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…nsafe-fix # Conflicts: # crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap
|
Done — switched to Heads up: the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
EXE004 fix can activate an encoding declaration
There was an error while loading. Please reload this page.