Skip to content

Commit ce774de

Browse files
berezovskyiclaude
andauthored
Add dotnet format pre-commit hook and CLAUDE.md symlink (#753)
* Add dotnet format pre-commit hook and CLAUDE.md symlink - 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> * chore: cleanup after precommit hook updates Signed-off-by: Andrew Berezovskyi <andriib@kth.se> --------- Signed-off-by: Andrew Berezovskyi <andriib@kth.se> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 32392ce commit ce774de

51 files changed

Lines changed: 464 additions & 453 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coderabbit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ reviews:
1919
path_instructions:
2020
- path: "**/*.cs"
2121
instructions: |
22-
Review the C# code against the Microsoft Framework design guidelines as well as 10 guidelines
22+
Review the C# code against the Microsoft Framework design guidelines as well as 10 guidelines
2323
from "Building Maintainable Software" by Joost Visser. Point out deviations and improvements.
2424
- path: "**/*.md"
2525
instructions: |

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
repos:
22
- repo: https://github.com/gitleaks/gitleaks
3-
rev: v8.16.3
3+
rev: v8.30.0
44
hooks:
55
- id: gitleaks
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.4.0
7+
rev: v6.0.0
88
hooks:
99
- id: end-of-file-fixer
1010
- id: trailing-whitespace
11+
- repo: local
12+
hooks:
13+
- id: dotnet-format
14+
name: dotnet format (whitespace + style, verify only)
15+
entry: bash -c 'cd OSLC4Net_SDK && dotnet format whitespace . --verify-no-changes && dotnet format style . --verify-no-changes --no-restore'
16+
language: system
17+
pass_filenames: false
18+
files: '\.cs$'

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"dotnet.defaultSolution": "OSLC4Net_SDK/OSLC4Net.Core.slnx"
3-
}
3+
}

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
"problemMatcher": "$msCompile"
3939
}
4040
]
41-
}
41+
}

AGENTS.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ Do not inline the `AGENT_BUILD` variable!
5656

5757
You must be CD'd into `OSLC4Net_SDK` or subfolder before running `dotnet` commands.
5858

59-
Run `dotnet format` before commit.
60-
6159
### Test Filters
6260

6361
Running TUnit via `dotnet run` supports test filters.
@@ -99,6 +97,19 @@ TUnit also supports filtering by your own [properties](https://thomhurst.github.
9997

10098
And if your test had a property with the name "MyFilterName" and its value contained "SomeValue", then your test would be executed.
10199

100+
## Formatting (required before every commit)
101+
102+
Run from the repo root:
103+
104+
```bash
105+
dotnet format whitespace ./OSLC4Net_SDK && dotnet format style ./OSLC4Net_SDK --no-restore
106+
```
107+
108+
- Use `whitespace` + `style` only. Skip `analyzers` — it runs third-party rules (Meziantou etc.) and is slow/noisy.
109+
- `--no-restore` on the second call avoids a redundant restore.
110+
- Also run this **after resolving merge conflicts**. Hand-edited hunks re-introduce style drift even when both parents were clean.
111+
- A pre-commit hook (`.pre-commit-config.yaml`) enforces this; install once with `pre-commit install`.
112+
102113
## Project Structure
103114

104115
- `OSLC4Net_SDK/` - Main SDK projects (.NET 10)

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

OSLC4Net_SDK/.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
"rollForward": false
1111
}
1212
}
13-
}
13+
}

OSLC4Net_SDK/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ README.md
2727
!.git/HEAD
2828
!.git/config
2929
!.git/packed-refs
30-
!.git/refs/heads/**
30+
!.git/refs/heads/**

OSLC4Net_SDK/Examples/OSLC4Net.Client.Jazz/Oslc/Jazz/JazzConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v1.0
66
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
7-
*
7+
*
88
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
99
* and the Eclipse Distribution License is available at
1010
* http://www.eclipse.org/org/documents/edl-v10.php.

OSLC4Net_SDK/Examples/OSLC4Net.Client.Jazz/Oslc/Jazz/JazzFormAuthClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v1.0
66
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
7-
*
7+
*
88
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
99
* and the Eclipse Distribution License is available at
1010
* http://www.eclipse.org/org/documents/edl-v10.php.
@@ -59,7 +59,7 @@ public JazzFormAuthClient(String url, String user, String password, ILogger<Oslc
5959
/// Create a new Jazz Form Auth client for the given URL, user and password
6060
/// </summary>
6161
/// <param name="url">the URL of the Jazz server, including the web app context</param>
62-
/// <param name="authUrl">the base URL to use for authentication. This is normally the
62+
/// <param name="authUrl">the base URL to use for authentication. This is normally the
6363
/// application base URL for RQM and RTC and is the JTS application URL for fronting
6464
/// applications like RRC and DM.</param>
6565
/// <param name="user"></param>

0 commit comments

Comments
 (0)