Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Dec 30, 2024

Ref #13295
https://docs.astral.sh/ruff/rules/#flake8-executable-exe

Lints about #! at the top of executable python files. (Doesn't affect Windows)

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

dhruvmanila pushed a commit to astral-sh/ruff that referenced this pull request Dec 31, 2024
…ndows solution to executable bit (#15208)

## Summary


I noticed that the solution mentioned in [shebang-not-executable
(EXE001)](https://docs.astral.sh/ruff/rules/shebang-not-executable/#shebang-not-executable-exe001)
was incorrect and likely copy-pasted from
[shebang-missing-executable-file
(EXE002)](https://docs.astral.sh/ruff/rules/shebang-missing-executable-file/#shebang-missing-executable-file-exe002)

It was telling users to remove the executable bit from a non-executable
file. Which does nothing.

I also noticed locally that:
- `chmod` wouldn't cause any file change to be noticed by git (`EXE` was
also passing locally) under WSL
- Using git allows anyone to fix this lint across OSes, for projects
with CIs using git

So I added a solution using [git update-index
--chmod](https://git-scm.com/docs/git-update-index#Documentation/git-update-index.txt---chmod-x)

## Test Plan

No test plan, doc changes only.
As for running the chmod commands:
python/typeshed#13346
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks, these seem very useful!

Copy link
Member

@AlexWaygood AlexWaygood Jan 2, 2025

Choose a reason for hiding this comment

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

Is the change here that the stub file was previously marked as executable for some reason, and now it (correctly) no longer is, because the lint rule picked up that it didn't have a shebang?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Exactly !

@AlexWaygood AlexWaygood merged commit a540f78 into python:main Jan 2, 2025
72 checks passed
@Avasam Avasam deleted the Ruff-EXE branch January 2, 2025 18:51
hoel-bagard pushed a commit to hoel-bagard/typeshed that referenced this pull request Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants