Add dotnet format pre-commit hook and CLAUDE.md symlink#753
Conversation
- Symlink CLAUDE.md -> AGENTS.md so Claude Code loads the existing agent instructions (mirrors the .aider.md/.clinerules/.cursorrules pattern) - Replace the buried "Run dotnet format before commit" line in AGENTS.md with a dedicated Formatting section that spells out the exact command (whitespace + style only; analyzers is slow/noisy) and flags merge commits as a known style-drift source - Add a local pre-commit hook that runs both subcommands with --verify-no-changes when .cs files are staged, so drift fails the commit instead of being noticed in CI or review Run 'pre-commit install' once per clone to activate the hook. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (47)
WalkthroughA local pre-commit hook is added to enforce C# code formatting via ChangesCode formatting enforcement via pre-commit hook
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Around line 102-106: The two conflicting instructions (the dotnet format
command that uses ./OSLC4Net_SDK and the earlier note that says you must be
inside OSLC4Net_SDK) should be reconciled: pick one consistent workflow and
update the text accordingly—either change the command to run without the
relative path when instructing "run from repo root" or change the guidance to
"cd into OSLC4Net_SDK" and remove the ./OSLC4Net_SDK prefix; update the examples
(the dotnet format whitespace ... and dotnet format style ... --no-restore) and
the prior sentence referencing being inside OSLC4Net_SDK so both reflect the
same location guidance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bb5d1db6-6ff7-4fc1-9e1a-948ed313e1f5
📒 Files selected for processing (3)
.pre-commit-config.yamlAGENTS.mdCLAUDE.md
| Run from the repo root: | ||
|
|
||
| ```bash | ||
| dotnet format whitespace ./OSLC4Net_SDK && dotnet format style ./OSLC4Net_SDK --no-restore | ||
| ``` |
There was a problem hiding this comment.
Conflicting command location guidance in this file
Line 102 says to run from repo root, but Line 57 says you must be inside OSLC4Net_SDK before running dotnet commands. Please make these instructions consistent in one direction to avoid developer confusion.
As per coding guidelines AGENTS.md: “Document agent implementations and capabilities in AGENTS.md file”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@AGENTS.md` around lines 102 - 106, The two conflicting instructions (the
dotnet format command that uses ./OSLC4Net_SDK and the earlier note that says
you must be inside OSLC4Net_SDK) should be reconciled: pick one consistent
workflow and update the text accordingly—either change the command to run
without the relative path when instructing "run from repo root" or change the
guidance to "cd into OSLC4Net_SDK" and remove the ./OSLC4Net_SDK prefix; update
the examples (the dotnet format whitespace ... and dotnet format style ...
--no-restore) and the prior sentence referencing being inside OSLC4Net_SDK so
both reflect the same location guidance.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #753 +/- ##
=======================================
Coverage 52.20% 52.20%
=======================================
Files 174 174
Lines 10254 10254
Branches 1021 1021
=======================================
Hits 5353 5353
Misses 4644 4644
Partials 257 257 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
Summary
CLAUDE.md→AGENTS.mdso Claude Code automatically loads the existing agent instructions (mirrors the existing.aider.md/.clinerules/.cursorrulespattern). Without this, Claude Code only sees the parent-directoryCLAUDE.md, which has no formatting guidance — the in-repoAGENTS.mdinstruction to rundotnet formatwas effectively invisible.AGENTS.mdfrom a single buried line into a dedicated## Formattingsection. Spells out the exact command (dotnet format whitespace+dotnet format style --no-restore), explains whyanalyzersis excluded (slow + third-party rules treated as errors elsewhere), and calls out merge commits as a known drift source.--verify-no-changeswhenever.csfiles are staged. Verify-only (no auto-fix) so the failure is loud and the developer runs the documented fix command themselves.Test plan
pre-commit installthen stage a deliberately mis-indented.csfile andgit commit— hook should fail with the offending file path.cschange — hook should pass.cschange (e.g. README edit) —dotnet-formathook should be skipped (files filter)cat CLAUDE.mdresolves to AGENTS.md contents (symlink works on Linux + macOS)🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Chores