Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.67 KB

formatting.md

File metadata and controls

48 lines (33 loc) · 1.67 KB

Code Formatting

The solution is formatted with the ReSharper command-line formatter (JetBrains.ReSharper.GlobalTools), pinned in the dotnet tool manifest (.config/dotnet-tools.json) so every contributor runs the same version. Whitespace rules come from the repository .editorconfig; the member layout and the cleanup profile live in RustPlusApi.sln.DotSettings.


Formatting manually

dotnet tool restore
dotnet jb cleanupcode RustPlusApi.sln --profile="ReformatAndReorder"

The ReformatAndReorder profile reformats and puts type members in the configured order (fields, properties, events, then methods, each grouped by accessibility). It never applies code-style rewrites or syntax changes.


The pre-push hook

A committed pre-push hook keeps unformatted code from leaving your machine:

  1. It collects the *.cs, *.csproj, *.props and *.targets files touched by the commits being pushed (new branches are compared against origin/develop).
  2. It runs the formatter scoped to just those files.
  3. If the formatter changes anything, the push is rejected and the fixed files are left in your working tree — review them, amend or commit, then push again.

Pre-existing local edits are ignored: only files the formatter itself modifies fail the check.

Setup

None. Building any project once (dotnet build) points git at the committed hooks via git config core.hooksPath .githooks (a target in Directory.Build.props; skipped on CI).

Bypassing

For emergencies only:

git push --no-verify