-
Notifications
You must be signed in to change notification settings - Fork 122
Add make format target #632
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
base: master
Are you sure you want to change the base?
Conversation
eb56ce0 to
6a33cb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 issues found across 5 files
Prompt for AI agents (all 4 issues)
Understand the root cause of the following 4 issues and fix them.
<file name="mk/wasm.mk">
<violation number="1" location="mk/wasm.mk:86">
By splitting the Safari requirement into major/minor constants without also defining SAFARI_SUPPORT_TCO_AT_MAJOR_MINOR (or updating the warning string), the warning now expands to an empty version number, leaving developers without the Safari version requirement.</violation>
</file>
<file name="Makefile">
<violation number="1" location="Makefile:497">
Guard the black version query so it isn’t executed when black is absent, otherwise every make invocation emits `/bin/sh: 1: --version: not found`.</violation>
<violation number="2" location="Makefile:508">
Ensure the generated prune expression always has a left-hand operand; when SUBMODULES is empty the current command becomes `find . ( -o … )` and fails.</violation>
<violation number="3" location="Makefile:515">
Failures in formatters are suppressed. The formatting commands are wrapped in `$(shell ...)` which prevents `make` from seeing their exit codes. If a formatter fails, the `make format` target will not fail, leading developers to believe formatting was successful when it was not. The commands should be executed directly, not inside `$(shell ...)`, so that `make` can properly handle their failure.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
8e059f1 to
a1ffaf2
Compare
Makefile
Outdated
| # If clang-format-x (x > 18) is used, change the 'clang-format-18' to 'clang-format-x' accordingly | ||
| CLANG_FORMAT := $(shell which clang-format-18 2>/dev/null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a known issue that clang-format versions 18 and 20+ produce inconsistent indentation, which prevents us from standardizing the formatter version across developers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a known issue that clang-format versions 18 and 20+ produce inconsistent indentation, which prevents us from standardizing the formatter version across developers.
Since clang-format-18 is still used in check-format.sh, we can stick with clang-format-18 for now IIUC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
clang-format-18is still use in check-format.sh, we can stick withclang-format-18for now IIUC?
Yes, it is specific to clang-format-18 for preferable indention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I would then remove the comment and force to use clang-format-18 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CONTRIBUTING.md is also modified to use clang-format-18 forcibly.
a1ffaf2 to
e3a5f93
Compare
Simplifies the formatting before creating PR, just 'make format'.
Version checking is needed for tools, e.g., emcc, browser, and
black(python formatting tool). Thus, introduce and refactor with
version_{eq,lt,lte,gt,gte} utils for better readability and
maintainability (no more 'Pyramid of Doom' checking for MAJOR, MINOR and
PATCH).
- To reflect the 'make format' new target. - Remove 'or later' to use clang-format-18 for consistency.
e3a5f93 to
b1ba59b
Compare
Description
make formattarget for easier formatting for developers.version_{eq, lt, lte, gt, gte}and refactor with them for tools:emcc, browsers(Chrome, Firefox, Safari),blackmake formattargetSummary by cubic
Adds a make format target to auto-format C/C++, shell, and Python, and introduces version-compare helpers to simplify build-time checks. This streamlines developer formatting and reduces brittle version logic.
New Features
Refactors
Written for commit b1ba59b. Summary will update automatically on new commits.