Skip to content

Set up dotnet format and CI enforcement#83

Open
hahn-kev-bot wants to merge 5 commits into
mainfrom
claude/dotnet-format-setup-4f7355
Open

Set up dotnet format and CI enforcement#83
hahn-kev-bot wants to merge 5 commits into
mainfrom
claude/dotnet-format-setup-4f7355

Conversation

@hahn-kev-bot

Copy link
Copy Markdown
Collaborator

Summary

Sets up dotnet format (built into the .NET SDK) with an .editorconfig capturing the project's conventions, and a CI workflow that enforces formatting on PRs and pushes to main.

Changes

  • .editorconfig — 4-space indent, file-scoped namespaces, Allman braces, using outside namespace, charset = utf-8 (no BOM). Line endings are intentionally left unmanaged (Windows CRLF working tree). The vendored src/Ycs port (C# port of Yjs) is marked generated_code = true so it's excluded from formatting/analysis.
  • .github/workflows/format.yaml — runs dotnet format --verify-no-changes on PRs and pushes to main. Default severity, so warnings + analyzers are enforced without failing on soft suggestions.
  • Analyzer fixes — resolved the analyzer diagnostics surfaced by the new config:
    • xUnit1051 (×3): pass TestContext.Current.CancellationToken to ToBlockingEnumerable / File.ReadAllLinesAsync.
    • IDE0019: use is not SqliteConnection pattern matching instead of as + null check.
  • Repo-wide format sweep — normalized whitespace, stripped UTF-8 BOMs, added final newlines, sorted using directives across 84 files. Formatting-only; no behavioral changes.

Verification

  • dotnet format --verify-no-changes → clean (exit 0)
  • dotnet test --configuration Release235 passed, 0 failed

Notes

  • No global.json, so CI uses whatever setup-dotnet@v4 installs (matching the existing workflows). Local dev here is on .NET 11 preview; different analyzer versions between local and CI could in theory produce slightly different results. Adding a global.json to pin the SDK would make this deterministic — not done here to stay consistent with the existing setup.

🤖 Generated with Claude Code

hahn-kev and others added 3 commits July 16, 2026 16:18
Add .editorconfig capturing the project's conventions and a Format
workflow that runs `dotnet format --verify-no-changes` on PRs and
pushes to main. The vendored Ycs port is excluded via generated_code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Pass TestContext.Current.CancellationToken to ToBlockingEnumerable and
  File.ReadAllLinesAsync so tests cancel responsively (xUnit1051).
- Use `is not SqliteConnection` pattern matching instead of `as` + null
  check in DataModelTestBase.ForkDatabase (IDE0019).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Normalize whitespace, strip UTF-8 BOMs, add final newlines, and sort
using directives to satisfy the new .editorconfig / Format workflow.
Formatting-only changes; no behavioral changes. Vendored src/Ycs is
excluded from formatting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 88 files, which is 38 over the limit of 50.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7af6f005-f9c0-412a-9e5d-b95916f27e8c

📥 Commits

Reviewing files that changed from the base of the PR and between 01efe25 and 11dab1f.

📒 Files selected for processing (89)
  • .editorconfig
  • .github/workflows/format.yaml
  • src/.editorconfig
  • src/SIL.Harmony.Core/ChangeEntity.cs
  • src/SIL.Harmony.Core/CommitBase.cs
  • src/SIL.Harmony.Core/CommitMetadata.cs
  • src/SIL.Harmony.Core/CrdtConstants.cs
  • src/SIL.Harmony.Core/EntityNotFoundException.cs
  • src/SIL.Harmony.Core/HybridDateTime.cs
  • src/SIL.Harmony.Core/IChangeContext.cs
  • src/SIL.Harmony.Core/IObjectBase.cs
  • src/SIL.Harmony.Core/IRemoteResourceService.cs
  • src/SIL.Harmony.Core/QueryHelpers.cs
  • src/SIL.Harmony.Core/ServerCommit.cs
  • src/SIL.Harmony.Core/SyncState.cs
  • src/SIL.Harmony.Linq2db/Linq2dbKernel.cs
  • src/SIL.Harmony.Sample/Changes/AddWordImageChange.cs
  • src/SIL.Harmony.Sample/Changes/EditExampleChange.cs
  • src/SIL.Harmony.Sample/Changes/NewDefinitionChange.cs
  • src/SIL.Harmony.Sample/Changes/NewExampleChange.cs
  • src/SIL.Harmony.Sample/Changes/NewWordChange.cs
  • src/SIL.Harmony.Sample/Changes/SetAntonymReferenceChange.cs
  • src/SIL.Harmony.Sample/Changes/SetDefinitionPartOfSpeechChange.cs
  • src/SIL.Harmony.Sample/Changes/SetTagChange.cs
  • src/SIL.Harmony.Sample/Changes/SetWordNoteChange.cs
  • src/SIL.Harmony.Sample/Changes/SetWordTextChange.cs
  • src/SIL.Harmony.Sample/Changes/TagWordChange.cs
  • src/SIL.Harmony.Sample/CrdtSampleKernel.cs
  • src/SIL.Harmony.Sample/Models/Definition.cs
  • src/SIL.Harmony.Sample/Models/Example.cs
  • src/SIL.Harmony.Sample/Models/Tag.cs
  • src/SIL.Harmony.Sample/Models/Word.cs
  • src/SIL.Harmony.Sample/Models/WordTag.cs
  • src/SIL.Harmony.Sample/SampleDbContext.cs
  • src/SIL.Harmony.Tests/Adapter/CustomObjectAdapterTests.cs
  • src/SIL.Harmony.Tests/CommitTests.cs
  • src/SIL.Harmony.Tests/ConfigTests.cs
  • src/SIL.Harmony.Tests/Core/HybridDateTimeTests.cs
  • src/SIL.Harmony.Tests/DataModelIntegrityTests.cs
  • src/SIL.Harmony.Tests/DataModelPerformanceTests.cs
  • src/SIL.Harmony.Tests/DataModelReferenceTests.cs
  • src/SIL.Harmony.Tests/DataModelSimpleChanges.cs
  • src/SIL.Harmony.Tests/DataModelTestBase.cs
  • src/SIL.Harmony.Tests/DataQueryTests.cs
  • src/SIL.Harmony.Tests/DbContextTests.cs
  • src/SIL.Harmony.Tests/DefinitionTests.cs
  • src/SIL.Harmony.Tests/DeleteAndCreateTests.cs
  • src/SIL.Harmony.Tests/ExampleSentenceTests.cs
  • src/SIL.Harmony.Tests/GlobalUsings.cs
  • src/SIL.Harmony.Tests/JsonSyncableTests.cs
  • src/SIL.Harmony.Tests/Mocks/MockTimeProvider.cs
  • src/SIL.Harmony.Tests/ModelSnapshotTests.cs
  • src/SIL.Harmony.Tests/ModuleInit.cs
  • src/SIL.Harmony.Tests/MultiThreadingTests.cs
  • src/SIL.Harmony.Tests/ObjectBaseTestingHelpers.cs
  • src/SIL.Harmony.Tests/PersistExtraDataTests.cs
  • src/SIL.Harmony.Tests/RepositoryTests.cs
  • src/SIL.Harmony.Tests/ResourceTests/RemoteResourcesMetadataTests.cs
  • src/SIL.Harmony.Tests/ResourceTests/RemoteResourcesTests.cs
  • src/SIL.Harmony.Tests/ResourceTests/RemoteServiceMock.cs
  • src/SIL.Harmony.Tests/ResourceTests/WordResourceTests.cs
  • src/SIL.Harmony.Tests/SnapshotTests.cs
  • src/SIL.Harmony.Tests/SyncTests.cs
  • src/SIL.Harmony.Tests/Syncable/SyncableTests.cs
  • src/SIL.Harmony/Adapters/CustomAdapterProvider.cs
  • src/SIL.Harmony/Adapters/DefaultAdapterProvider.cs
  • src/SIL.Harmony/Adapters/IObjectAdapterProvider.cs
  • src/SIL.Harmony/Changes/DeleteChange.cs
  • src/SIL.Harmony/Changes/SetOrderChange.cs
  • src/SIL.Harmony/CommitValidationException.cs
  • src/SIL.Harmony/CrdtConfig.cs
  • src/SIL.Harmony/CrdtKernel.cs
  • src/SIL.Harmony/DataModel.cs
  • src/SIL.Harmony/Db/CrdtDbContextFactory.cs
  • src/SIL.Harmony/Db/CrdtDbContextOptionsExtensions.cs
  • src/SIL.Harmony/Db/CrdtRepository.cs
  • src/SIL.Harmony/Entities/IPolyType.cs
  • src/SIL.Harmony/Helpers/DerivedTypeHelper.cs
  • src/SIL.Harmony/Helpers/LinqHelpers.cs
  • src/SIL.Harmony/Resource/CreateRemoteResourceChange.cs
  • src/SIL.Harmony/Resource/CreateRemoteResourcePendingUpload.cs
  • src/SIL.Harmony/Resource/HarmonyResource.cs
  • src/SIL.Harmony/Resource/LocalResource.cs
  • src/SIL.Harmony/Resource/RemoteResource.cs
  • src/SIL.Harmony/Resource/RemoteResourceNotEnabledException.cs
  • src/SIL.Harmony/Resource/RemoteResourceUploadedChange.cs
  • src/SIL.Harmony/ResourceService.cs
  • src/SIL.Harmony/SnapshotWorker.cs
  • src/SIL.Harmony/SyncHelper.cs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Review on demand using usage pricing
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/dotnet-format-setup-4f7355

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread .github/workflows/format.yaml Fixed
Remove the redundant src/.editorconfig. Its two meaningful rules are
migrated to the root config:
- VSTHRD200 severity = none (don't require Async suffix on async methods)
- Verify snapshot files (*.received/*.verified) excluded from reformatting

The duplicate indent_size/charset rules are dropped (already set globally).
Fixed the stray quotes on the Verify charset value (utf-8-bom).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hahn-kev hahn-kev marked this pull request as ready for review July 16, 2026 09:50

@myieye myieye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The space standardization brought a bunch of stuff closer to what I expect ❤️

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants