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

fix: Ruff rule EXE001 (shebang-not-executable) #899

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

bartsanchez
Copy link
Contributor

@boriel boriel self-requested a review November 19, 2024 20:51
Copy link
Collaborator

@boriel boriel left a comment

Choose a reason for hiding this comment

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

Sorry :-(

After a 2nd review, I realized that It should be exactly the opposite: remove that shebang from all non-executable files.
Only zxbc.py, zxbasm.py and zxbpp.py (in root folder and src/ sub-folders) should be executable. The rest should be imported.

@bartsanchez
Copy link
Contributor Author

Sorry :-(

After a 2nd review, I realized that It should be exactly the opposite: remove that shebang from all non-executable files. Only zxbc.py, zxbasm.py and zxbpp.py (in root folder and src/ sub-folders) should be executable. The rest should be imported.

OK, cool. No worries. I am modifying the PR.

@bartsanchez bartsanchez force-pushed the bart/fix-ruff-rule-EXE001 branch from ec9de08 to 2103037 Compare November 20, 2024 22:46
@bartsanchez bartsanchez requested a review from boriel November 20, 2024 22:55
@bartsanchez
Copy link
Contributor Author

bartsanchez commented Nov 20, 2024

Note that the following files are also defining a shebang but they are executable:

❯ rg --multiline --multiline-dotall '^#!' --files-with-matches 
tools/profile.sh
tools/normalize_asm.py
tools/mulfix.py
tools/scrview.py
tools/nextcreator.py
tools/normalize_bas.py
zxbc.py
docs/imgs.sh
tests/runtime/test_all
tests/runtime/test_case
tests/runtime/update_test.py
tests/runtime/check_test.py
tests/runtime/update_test.sh
zxbpp.py
zxbasm.py
src/zxbasm/basic.py
src/zxbasm/asmlex.py
src/zxbasm/zxbasm.py
src/arch/z80/beep.py
src/zxbasm/asmparse.py
src/api/fp.py
src/arch/z80/__init__.py
src/arch/zx48k/__init__.py
src/arch/zx48k/beep.py
src/arch/zxnext/__init__.py
src/zxbc/keywords.py
src/zxbc/zxblex.py
src/zxbc/zxbc.py
tests/functional/test_.py
tests/functional/test_basic.py
src/zxbc/zxbparser.py
src/outfmt/tap.py
tests/functional/test_prepro.py
tests/functional/test_asm.py
src/zxbpp/zxbasmpplex.py
src/zxbpp/base_pplex.py
src/outfmt/tzx.py
tests/functional/test.py
src/zxbpp/zxbpp.py
src/zxbpp/zxbpplex.py

@boriel
Copy link
Collaborator

boriel commented Nov 21, 2024

Note that the following files are also defining a shebang but they are executable:

❯ rg --multiline --multiline-dotall '^#!' --files-with-matches 
tools/profile.sh
tools/normalize_asm.py
tools/mulfix.py
tools/scrview.py
tools/nextcreator.py
tools/normalize_bas.py
zxbc.py
docs/imgs.sh
tests/runtime/test_all
tests/runtime/test_case
tests/runtime/update_test.py
tests/runtime/check_test.py
tests/runtime/update_test.sh
zxbpp.py
zxbasm.py
src/zxbasm/basic.py
src/zxbasm/asmlex.py
src/zxbasm/zxbasm.py
src/arch/z80/beep.py
src/zxbasm/asmparse.py
src/api/fp.py
src/arch/z80/__init__.py
src/arch/zx48k/__init__.py
src/arch/zx48k/beep.py
src/arch/zxnext/__init__.py
src/zxbc/keywords.py
src/zxbc/zxblex.py
src/zxbc/zxbc.py
tests/functional/test_.py
tests/functional/test_basic.py
src/zxbc/zxbparser.py
src/outfmt/tap.py
tests/functional/test_prepro.py
tests/functional/test_asm.py
src/zxbpp/zxbasmpplex.py
src/zxbpp/base_pplex.py
src/outfmt/tzx.py
tests/functional/test.py
src/zxbpp/zxbpp.py
src/zxbpp/zxbpplex.py

And this is ok.
Files in tools/ can be used directly from the command line.
zxbc.py
zxbpp.py
zxbasm.py
.sh files are executable.

The only ones that should not have a shebang for sure are the __init__.py files
and those not having a if __name__ == "__main__": sequence.

@boriel boriel merged commit 298c591 into boriel-basic:main Nov 22, 2024
1 check passed
@bartsanchez bartsanchez deleted the bart/fix-ruff-rule-EXE001 branch December 4, 2024 19:57
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