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

SCons: Apply new ruff/mypy fixes #102371

Merged
merged 1 commit into from
Feb 3, 2025
Merged

Conversation

Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Feb 3, 2025

Integrates new fixes found by the updated mypy/ruff hooks. Should've done this during/before the above PR was merged, but I forgot 🙃. This goes beyond codestyle, as a regression was identified and fixed in the process.

@@ -499,7 +499,7 @@ def build_gles3_header(
fd.write("\t\t};\n\n")
variant_count = len(header_data.variant_defines)
else:
fd.write("\t\tstatic const char **_variant_defines[]={" "};\n")
fd.write('\t\tstatic const char **_variant_defines[]={" "};\n')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the offending line, as the original fix was:

-           fd.write("\t\tstatic const char **_variant_defines[]={" "};\n")
+           fd.write("\t\tstatic const char **_variant_defines[]={};\n")

The intent was to have the fallback container store a single value, but the outer double quotes meant Python was concatenating two strings instead, resulting in an empty container. Using single quotes restores the intended behavior.

Copy link
Contributor

@Chubercik Chubercik left a comment

Choose a reason for hiding this comment

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

Oh, that's weird. I thought pre-commit would notify me of any new changes when committing after updating locally. My bad; I'll remember to run the full suite if I happen to update ruff/mypy in the future.

@Repiteo
Copy link
Contributor Author

Repiteo commented Feb 3, 2025

@Chubercik By default, pre-commit only runs on files that were locally changed. You'll have to be more explicit otherwise, but it can be trimmed down to just the hooks you want to run:

pre-commit run ruff -a && pre-commit run ruff-format -a && pre-commit run mypy -a

@Repiteo Repiteo merged commit 23c6292 into godotengine:master Feb 3, 2025
19 checks passed
@Repiteo Repiteo deleted the scons/ruff-mypy branch February 3, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants