flake8-executable
flake8-executable copied to clipboard
Check __name__ == ‘__main__’?
Thanks for the great plugin.
What do you think about adding name == main checks vs the shebang line, under a couple of new EXEnnn IDs?
- Found name == main but no shebang
- Found shebang but no name == main
I frequently forget both the executable bit and the shebang when writing new command line scripts, so this would help. This also encourages better modularity and easier to package the script later as a setuptools entry_point. And finally. ensuring shebang lines aren’t added when they shouldn’t be.
If you agree, I can work on a PR.
@pkolbus Sorry for the delayed response -- I missed the notification somehow. Yes, I think this would be helpful. Feel free to contribute a PR! Also, feel free to ping me if you don't see me responding.
Thanks for the response. I'd actually forgotten about this issue and wrote a shell script for the executability checks, but will take another look at this plugin soon & either write the PR or close.
It might be even better to check:
- Found name == main but no shebang or no executable bit set
- Found shebang executable bit set, but no name == main
Feel free to split the PR to address them separately, so it won't be too stressful.