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

False-positive ERA001 with # nuitka-project: configuration #4618

Closed
bersbersbers opened this issue May 24, 2023 · 6 comments · Fixed by #4644
Closed

False-positive ERA001 with # nuitka-project: configuration #4618

bersbersbers opened this issue May 24, 2023 · 6 comments · Fixed by #4644

Comments

@bersbersbers
Copy link
Contributor

https://github.com/Nuitka/Nuitka allows in-file configurations:

# nuitka-project: --onefile
# nuitka-project: --onefile-windows-splash-screen-image={MAIN_DIRECTORY}/Splash-Screen.png

# Whatever this is obviously
print("Delaying startup by 10s...")
import time, tempfile, os
time.sleep(10)

# Use this code to signal the splash screen removal.
if "NUITKA_ONEFILE_PARENT" in os.environ:
   splash_filename = os.path.join(
      tempfile.gettempdir(),
      "onefile_%d_splash_feedback.tmp" % int(os.environ["NUITKA_ONEFILE_PARENT"]),
   )

   if os.path.exists(splash_filename):
      os.unlink(splash_filename)

print("Done... splash should be gone.")
...

# Rest of your program goes here.

I find lines starting with # nuitka-project: should not be flagged as ERA001 (and not be removed by --fix).

(If there was an option to disable ERA001 for certain keywords, users could configure that themselves.)

@bersbersbers
Copy link
Contributor Author

Alternatively, being able to disable ERA001 for this block would also be an option. I know how to suppress it for a single line or the whole file, but not a block.

@JonathanPlasse
Copy link
Contributor

You can use task-tags

task-tags = ["nuitka-project"]

@bersbersbers
Copy link
Contributor Author

You can use task-tags

This is great! It would be even greater if that was documented at https://beta.ruff.rs/docs/rules/commented-out-code/ and https://beta.ruff.rs/docs/rules/line-too-long/, then I would have found it without opening this issue :)

@JonathanPlasse
Copy link
Contributor

Would you be open to making a pull-request for this?

@bersbersbers
Copy link
Contributor Author

@JonathanPlasse sure, see #4644.

@charliermarsh
Copy link
Member

Thank you!

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 a pull request may close this issue.

3 participants