Skip to content

chore: Add husky-rs git pre-push hook to clippy and fmt#5002

Merged
jedel1043 merged 3 commits intoboa-dev:mainfrom
hansl:git-hooks
Mar 13, 2026
Merged

chore: Add husky-rs git pre-push hook to clippy and fmt#5002
jedel1043 merged 3 commits intoboa-dev:mainfrom
hansl:git-hooks

Conversation

@hansl
Copy link
Contributor

@hansl hansl commented Mar 11, 2026

No need to do that on every commit, but pushing will help people stop pushing things that fail Lint on CI. Like me. I do that.

@hansl hansl requested a review from a team as a code owner March 11, 2026 18:33
@hansl hansl changed the title chore: Add husky pre-push hook to clippy and fmt chore: Add husky-rs git pre-push hook to clippy and fmt Mar 11, 2026
@github-actions
Copy link

github-actions bot commented Mar 11, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,902 49,901 -1
Ignored 2,222 2,222 0
Failed 839 840 +1
Panics 0 0 0
Conformance 94.22% 94.22% -0.00%
Broken tests (1):
test/built-ins/Object/freeze/typedarray-backed-by-resizable-buffer.js (previously Passed)

Tested main commit: 8225dc5409d9b41eb4b8045c657122c9c28a503b
Tested PR commit: dbb995173439b541a079a22360626fad821f5c71
Compare commits: 8225dc5...dbb9951

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.42%. Comparing base (6ddc2b4) to head (dbb9951).
⚠️ Report is 820 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5002       +/-   ##
===========================================
+ Coverage   47.24%   58.42%   +11.18%     
===========================================
  Files         476      559       +83     
  Lines       46892    61459    +14567     
===========================================
+ Hits        22154    35910    +13756     
- Misses      24738    25549      +811     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jedel1043 jedel1043 added the A-Meta Issues and PRs related to the repository itself label Mar 12, 2026
.husky/pre-push Outdated
Comment on lines +3 to +15
echo "Running cargo fmt check..."
cargo fmt --all -- --check
if [ $? -ne 0 ]; then
echo "cargo fmt check failed. Run 'cargo fmt --all' to fix formatting."
exit 1
fi

echo "Running cargo clippy..."
cargo clippy --all-targets --all-features -- -D warnings
if [ $? -ne 0 ]; then
echo "cargo clippy failed. Fix the warnings above before pushing."
exit 1
fi
Copy link
Member

@jedel1043 jedel1043 Mar 12, 2026

Choose a reason for hiding this comment

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

I would just run cargo make run-ci TBH. It's an additional step of having to install cargo-make, but we should require it for contributions IMO

Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think about just adding a .devcontainer.json ?
then you can add whatever you want in there and make dev environment more consistent.
(at least for people (incl. me) on linux life should get easier)

Copy link
Contributor

@zhuzhu81998 zhuzhu81998 Mar 12, 2026

Choose a reason for hiding this comment

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

and a vscode settings.json could let vscode use cargo to format files on save automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jedel1043 done.

@zhuzhu81998 most people don't have dev containers. Husky hooks into git so it always run for sure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jedel1043 jedel1043 added this pull request to the merge queue Mar 13, 2026
Merged via the queue into boa-dev:main with commit dcb6cb6 Mar 13, 2026
19 checks passed
@hansl hansl deleted the git-hooks branch March 13, 2026 00:32
@alienx5499
Copy link
Contributor

Hi @jedel1043,
Hi @hansl,

I ran into an issue with the new pre-push hook on macOS when the shell
environment uses GCC as the default compiler (e.g. CC=gcc-15).

cargo make run-ci builds aws-lc-sys, which pulls macOS SDK headers
containing Objective-C block syntax. GCC doesn't support ObjC blocks,
so the build fails with errors like:

MDItem.h:178:69: error: expected ')' before '^' token

This happens because the hook inherits CC/CXX from the user's shell.

One possible fix would be forcing Clang inside .husky/pre-push:

export CC=clang
export CXX=clang++

If this approach looks reasonable, I can open a PR adding this to the hook.

@jedel1043
Copy link
Member

jedel1043 commented Mar 14, 2026

This happens because the hook inherits CC/CXX from the user's shell.

That sounds like something you need to fix from your end then? Because adding that in the pre-push script would force Windows contributors to use clang instead of the VS build tools

@alienx5499
Copy link
Contributor

Maybe we could scope it only to macOS and only when CC isn’t already set, something like:

if [[ "$OSTYPE" == "darwin"* ]] && [ -z "$CC" ]; then
  export CC=clang
  export CXX=clang++
fi

That way it wouldn’t affect Windows or Linux environments.

@jedel1043
Copy link
Member

Honestly we should just kill aws-lc-rs with fire and use ring IMO

@jedel1043
Copy link
Member

Opened #5068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Meta Issues and PRs related to the repository itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants