Context
This repository currently has the right high-level idea: reusable pre-commit checks for .NET projects. The existing TODO points to build, test, format, and coverage checks, and the linked OnRails scripts show the intended behavior.
The main risk is turning this into a collection of project-specific shell scripts. The more useful direction is to make this a real pre-commit hook repository that .NET projects can consume with a small .pre-commit-config.yaml entry.
Recommended direction
Build a small, focused hook repository for .NET quality gates:
dotnet-build
dotnet-test
dotnet-format
dotnet-coverage
Prefer a .NET CLI tool behind the hooks instead of bash-only scripts. pre-commit supports language: dotnet, but the repository should contain a .NET CLI tool that can be packed and installed. This gives better cross-platform behavior and a stronger resume/project story than shell scripts alone.
Technical suggestions
- Add
.pre-commit-hooks.yaml with stable hook IDs, names, entries, stages, and pass_filenames: false for solution-level commands.
- Implement a small CLI, for example
pre-commit-dotnet, with subcommands such as build, test, format, and coverage.
- Support solution/project selection through arguments:
--path <sln|slnx|csproj|directory>
--configuration Debug|Release
--framework <tfm> when needed
--no-restore / --restore
--property NuGetAudit=false or a general MSBuild property pass-through option
- Make coverage threshold configurable:
--line-threshold <number>
--branch-threshold <number>
- support Cobertura output from
XPlat Code Coverage
- Avoid hardcoded repository paths, folder names, or project-specific rules. Any path filtering should be opt-in through args.
- Keep the first version intentionally narrow: no replacement for Husky.Net, no full CI framework, no broad lint-staged clone.
- Provide clear exit codes and concise output so hook failures are easy to understand.
- Add sample projects under
samples/ to demonstrate common use cases.
- Add automated tests for argument parsing, command construction, coverage parsing, and failure output.
- Add CI on Ubuntu and Windows at minimum. macOS can be added later if needed.
- Add a README with quickstart examples, including:
repos:
- repo: https://github.com/Payadel/pre-commit-dotnet
rev: v0.1.0
hooks:
- id: dotnet-format
- id: dotnet-build
args: [--path, MySolution.sln]
- id: dotnet-test
args: [--path, MySolution.sln, --no-restore]
- id: dotnet-coverage
args: [--path, tests/MyProject.Tests/MyProject.Tests.csproj, --line-threshold, "80"]
Suggested MVP
- Create the .NET CLI project.
- Add
.pre-commit-hooks.yaml.
- Implement
format, build, and test.
- Add one sample .NET project and test the hooks with
pre-commit try-repo.
- Add README quickstart.
- Tag
v0.1.0.
- Add
coverage after the basic hooks are stable.
Acceptance checklist
Non-goals for now
- Competing directly with Husky.Net.
- Implementing a general-purpose task runner.
- Supporting every possible dotnet CLI option in v0.1.
- Adding complex changed-file detection before the basic hook flow is stable.
Why this is worth doing
This is not likely to become a strong standalone business, but it can be useful as:
- a practical .NET developer tool,
- a reusable helper for personal and team projects,
- a compact resume project if packaged and documented well,
- a learning project around CLI design, cross-platform tooling, pre-commit internals, and release hygiene.
Context
This repository currently has the right high-level idea: reusable pre-commit checks for .NET projects. The existing TODO points to build, test, format, and coverage checks, and the linked OnRails scripts show the intended behavior.
The main risk is turning this into a collection of project-specific shell scripts. The more useful direction is to make this a real pre-commit hook repository that .NET projects can consume with a small
.pre-commit-config.yamlentry.Recommended direction
Build a small, focused hook repository for .NET quality gates:
dotnet-builddotnet-testdotnet-formatdotnet-coveragePrefer a .NET CLI tool behind the hooks instead of bash-only scripts.
pre-commitsupportslanguage: dotnet, but the repository should contain a .NET CLI tool that can be packed and installed. This gives better cross-platform behavior and a stronger resume/project story than shell scripts alone.Technical suggestions
.pre-commit-hooks.yamlwith stable hook IDs, names, entries, stages, andpass_filenames: falsefor solution-level commands.pre-commit-dotnet, with subcommands such asbuild,test,format, andcoverage.--path <sln|slnx|csproj|directory>--configuration Debug|Release--framework <tfm>when needed--no-restore/--restore--property NuGetAudit=falseor a general MSBuild property pass-through option--line-threshold <number>--branch-threshold <number>XPlat Code Coveragesamples/to demonstrate common use cases.Suggested MVP
.pre-commit-hooks.yaml.format,build, andtest.pre-commit try-repo.v0.1.0.coverageafter the basic hooks are stable.Acceptance checklist
.pre-commit-config.yaml..sln,.slnx,.csproj, and directory paths where practical.pre-commitwithrev: v0.1.0.Non-goals for now
Why this is worth doing
This is not likely to become a strong standalone business, but it can be useful as: