-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
SCons: ruff
SConstruct/SCsub fixes
#92264
SCons: ruff
SConstruct/SCsub fixes
#92264
Conversation
May have to update the guides at https://docs.godotengine.org/en/stable/contributing/development/core_and_modules/custom_modules_in_cpp.html |
I'm not sure solving these warnings actually improves the quality of our code. It's a lot of boilerplate to workaround the design of SCons. |
I suggest a lighter way, but as powerful. We can import variables in python. How about we do this? # /typed_scons.py
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from SCons.Script.SConscript import SConsEnvironment
env = SConsEnvironment()
Import = SConsEnvironment.Import Then, in any SCsub file, we can do: # /platforms/web/SCsub
from typed_scons import *
# ... rest of the SCsub file |
That's similar to another PR I've setup previously, #86213, but ruff doesn't love the syntax: |
Yeah, I kinda forgot about installing ruff on VSCode. Sorry! |
Superseded by #93058 |
Now that
ruff
is properly merged as our linter/formatter of choice, it's now appropriate to fix the previously ignored warnings for SConstruct/SCsub files:E402
&F821
. As indicated by this PR changing 177 files, this wasn't exactly suitable for that initial PR. Despite the amount of files changed, the majority of changes were assigning some variation of this to the top of every SCsub:Remaining changes were ensuring imports at the top level (where applicable) & changing most "native" SCons functions into explicit class calls via
env
to make them typed. With these changes in place, it's now feasible for a followup PR to make the SConstruct/SCsub files supportmypy
checks (currently only applied to.py
files), as the major typing ambiguities will have been dealt with.