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

Check __name__ == ‘__main__’? #2

Open
pkolbus opened this issue Jan 22, 2020 · 3 comments
Open

Check __name__ == ‘__main__’? #2

pkolbus opened this issue Jan 22, 2020 · 3 comments

Comments

@pkolbus
Copy link

pkolbus commented Jan 22, 2020

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.

@xuhdev
Copy link
Owner

xuhdev commented Nov 23, 2020

@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.

@pkolbus
Copy link
Author

pkolbus commented Nov 27, 2020

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.

@xuhdev
Copy link
Owner

xuhdev commented Nov 28, 2020

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.

This was referenced Jan 13, 2023
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

No branches or pull requests

2 participants