Skip to content

Dotnet support#1783

Open
snus-kin wants to merge 47 commits intoj178:masterfrom
snus-kin:feature/dotnet-support
Open

Dotnet support#1783
snus-kin wants to merge 47 commits intoj178:masterfrom
snus-kin:feature/dotnet-support

Conversation

@snus-kin
Copy link

Hi, I thought I'd give a stab at dotnet support for prek. Not really an amazing language for how it manages tools & its toolchain, so perhaps some nastiness. Seems to work for csharpier at least for me.

There's some missing tests around the windows part of the code in the coverage but I didn't want to get into messing with CI for windows runners, maybe we can drop the powershell stuff if we make windows people run in a bash type environment?

Not very versed in rust but hoping that even if stuff's bad there's a bit of a start for someone better than I to have a stab at.

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 95.64586% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.88%. Comparing base (9782923) to head (13138bf).

Files with missing lines Patch % Lines
crates/prek/src/languages/dotnet/installer.rs 93.61% 23 Missing ⚠️
crates/prek/src/languages/dotnet/dotnet.rs 96.61% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1783      +/-   ##
==========================================
+ Coverage   91.72%   91.88%   +0.16%     
==========================================
  Files          98      101       +3     
  Lines       20055    20744     +689     
==========================================
+ Hits        18395    19061     +666     
- Misses       1660     1683      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prek-ci-bot
Copy link

prek-ci-bot bot commented Mar 12, 2026

📦 Cargo Bloat Comparison

Binary size change: +0.40% (24.8 MiB → 24.9 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_encrypt_avx512
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  81.4KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  74.5KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  68.5KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.5%  57.0KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4%  51.0KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  46.1KiB              prek prek::run::{{closure}}
 0.2%   0.3%  41.8KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.8KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble
 0.1%   0.2%  25.8KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  25.3KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  25.3KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  23.0KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2%  22.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  21.6KiB              prek prek::workspace::Project::init_hooks::{{closure}}
41.1%  85.9%  10.2MiB                   And 23356 smaller methods. Use -n N to show more.
47.9% 100.0%  11.9MiB                   .text section size, the file size is 24.9MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_encrypt_avx512
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  81.7KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.6%  77.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  69.8KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.4%  51.0KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  50.6KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4%  46.1KiB              prek prek::run::{{closure}}
 0.2%   0.3%  41.8KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.8KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble
 0.1%   0.2%  25.8KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  25.3KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  23.2KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2%  22.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  22.0KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  21.6KiB              prek prek::workspace::Project::init_hooks::{{closure}}
41.1%  85.9%  10.2MiB                   And 23317 smaller methods. Use -n N to show more.
47.8% 100.0%  11.9MiB                   .text section size, the file size is 24.8MiB

@prek-ci-bot
Copy link

prek-ci-bot bot commented Mar 12, 2026

⚡️ Hyperfine Benchmarks

Summary: 0 regressions, 0 improvements above the 10% threshold.

Environment
  • OS: Linux 6.14.0-1017-azure
  • CPU: 4 cores
  • prek version: prek 0.3.6+50 (3820df1 2026-03-16)
  • Rust version: rustc 1.94.0 (4a4ef493e 2026-03-02)
  • Hyperfine version: hyperfine 1.20.0
CLI Commands

Benchmarking basic commands in the main repo:

prek --version

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base --version 2.4 ± 0.1 2.3 2.9 1.01 ± 0.06
prek-head --version 2.4 ± 0.1 2.2 3.1 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 8.9 ± 0.1 8.7 9.3 1.00
prek-head list 9.0 ± 0.1 8.8 9.7 1.01 ± 0.02

prek validate-config .pre-commit-config.yaml

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base validate-config .pre-commit-config.yaml 3.1 ± 0.0 3.0 3.3 1.01 ± 0.02
prek-head validate-config .pre-commit-config.yaml 3.1 ± 0.1 3.0 3.2 1.00

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.7 ± 0.3 2.5 5.0 1.02 ± 0.13
prek-head sample-config 2.6 ± 0.1 2.5 2.8 1.00
Cold vs Warm Runs

Comparing first run (cold) vs subsequent runs (warm cache):

prek run --all-files (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 158.9 ± 5.0 154.7 169.2 1.00 ± 0.03
prek-head run --all-files 158.6 ± 2.1 155.4 162.1 1.00

prek run --all-files (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 159.5 ± 3.3 154.3 166.5 1.00
prek-head run --all-files 160.2 ± 3.5 154.4 168.4 1.00 ± 0.03
Full Hook Suite

Running the builtin hook suite on the benchmark workspace:

prek run --all-files (full builtin hook suite)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 160.5 ± 4.6 154.7 180.3 1.00
prek-head run --all-files 163.9 ± 38.3 152.8 428.1 1.02 ± 0.24
Individual Hook Performance

Benchmarking each hook individually on the test repo:

prek run trailing-whitespace --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run trailing-whitespace --all-files 22.8 ± 0.6 22.1 24.2 1.03 ± 0.03
prek-head run trailing-whitespace --all-files 22.0 ± 0.3 21.5 22.7 1.00

prek run end-of-file-fixer --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run end-of-file-fixer --all-files 28.9 ± 2.7 25.0 37.4 1.00
prek-head run end-of-file-fixer --all-files 28.9 ± 2.3 25.9 33.2 1.00 ± 0.12

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 13.1 ± 0.3 12.6 13.7 1.02 ± 0.05
prek-head run check-json --all-files 12.8 ± 0.5 11.8 14.0 1.00

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 12.2 ± 0.3 11.8 12.9 1.00
prek-head run check-yaml --all-files 12.3 ± 0.3 11.9 13.1 1.00 ± 0.03

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 12.7 ± 0.4 12.1 13.8 1.02 ± 0.04
prek-head run check-toml --all-files 12.5 ± 0.3 11.9 13.3 1.00

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 12.5 ± 0.4 11.7 13.1 1.00
prek-head run check-xml --all-files 12.8 ± 1.7 12.0 20.6 1.02 ± 0.14

prek run detect-private-key --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 18.9 ± 1.3 16.7 21.8 1.00
prek-head run detect-private-key --all-files 19.1 ± 1.4 16.9 22.4 1.01 ± 0.10

prek run fix-byte-order-marker --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run fix-byte-order-marker --all-files 24.8 ± 1.7 21.2 27.3 1.03 ± 0.10
prek-head run fix-byte-order-marker --all-files 24.1 ± 1.8 21.4 27.6 1.00
Installation Performance

Benchmarking hook installation (fast path hooks skip Python setup):

prek install-hooks (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.8 ± 0.0 4.8 4.9 1.01 ± 0.02
prek-head install-hooks 4.8 ± 0.1 4.7 4.8 1.00

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.8 ± 0.0 4.7 4.8 1.00
prek-head install-hooks 4.8 ± 0.1 4.7 4.9 1.00 ± 0.02
File Filtering/Scoping Performance

Testing different file selection modes:

prek run (staged files only)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run 53.9 ± 1.1 52.2 56.5 1.00
prek-head run 54.2 ± 1.4 52.0 56.8 1.00 ± 0.03

prek run --files '*.json' (specific file type)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 9.2 ± 0.2 8.9 9.6 1.00
prek-head run --files '*.json' 9.2 ± 0.2 8.9 9.8 1.00 ± 0.03
Workspace Discovery & Initialization

Benchmarking hook discovery and initialization overhead:

prek run --dry-run --all-files (measures init overhead)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --dry-run --all-files 14.5 ± 0.4 14.0 15.4 1.01 ± 0.03
prek-head run --dry-run --all-files 14.3 ± 0.3 14.0 15.1 1.00
Meta Hooks Performance

Benchmarking meta hooks separately:

prek run check-hooks-apply --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-hooks-apply --all-files 14.2 ± 0.8 12.7 15.1 1.10 ± 0.06
prek-head run check-hooks-apply --all-files 13.0 ± 0.2 12.7 13.3 1.00

prek run check-useless-excludes --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-useless-excludes --all-files 13.1 ± 0.4 12.7 14.1 1.00
prek-head run check-useless-excludes --all-files 13.1 ± 0.3 12.7 13.7 1.00 ± 0.04

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 11.3 ± 0.1 11.2 11.6 1.00
prek-head run identity --all-files 11.4 ± 0.3 11.1 12.1 1.01 ± 0.03

@snus-kin snus-kin force-pushed the feature/dotnet-support branch 3 times, most recently from 2625a90 to c44b3ea Compare March 13, 2026 10:30
@snus-kin snus-kin marked this pull request as ready for review March 13, 2026 12:37
@snus-kin snus-kin requested a review from j178 as a code owner March 13, 2026 12:37
Copilot AI review requested due to automatic review settings March 13, 2026 12:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET (language: dotnet) support to prek, including SDK selection via language_version, tool installation via additional_dependencies, documentation updates, and CI wiring to run the new language test suite.

Changes:

  • Implement dotnet language: SDK discovery/download + dotnet tool install --tool-path dependency support.
  • Add unit + integration tests for dotnet behavior and wire dotnet into language test matrix.
  • Update docs and nextest profiles to reflect supported dotnet hooks.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
docs/languages.md Documents dotnet language support, language_version, and additional_dependencies.
crates/prek/tests/run.rs Updates an invalid-config test now that dotnet supports deps (uses swift instead).
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds end-to-end integration tests for dotnet hooks, versions, deps, and error handling.
crates/prek/tests/common/mod.rs Adds an insta output filter intended for dotnet version output.
crates/prek/src/store.rs Adds ToolBucket::Dotnet for tool storage.
crates/prek/src/languages/version.rs Adds LanguageRequest::Dotnet parsing/satisfaction plumbing.
crates/prek/src/languages/mod.rs Wires dotnet into supported languages, tool buckets, version support, install/run/health dispatch.
crates/prek/src/languages/dotnet/version.rs Implements dotnet language_version parsing and matching (major / major.minor / exact / netX.Y).
crates/prek/src/languages/dotnet/mod.rs Adds the dotnet language module exports.
crates/prek/src/languages/dotnet/installer.rs Implements system discovery + managed install via dotnet-install scripts.
crates/prek/src/languages/dotnet/dotnet.rs Implements hook install/run/health-check and dependency installation for dotnet hooks.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Installs .NET in CI for the dotnet language matrix entry.
.config/nextest.toml Adds a lang-dotnet nextest profile to run dotnet language tests.

Copilot AI review requested due to automatic review settings March 13, 2026 17:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET (dotnet) language support to prek, including SDK version selection and dotnet tool installation for hooks.

Changes:

  • Implement dotnet language: SDK discovery/download + hook execution environment setup.
  • Add dotnet-specific tests, nextest profile, and CI setup-dotnet wiring.
  • Update documentation to describe supported dotnet behavior and configuration options.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
docs/languages.md Documents dotnet language support, language_version, and additional_dependencies.
crates/prek/tests/run.rs Updates an “invalid config” test to use swift instead of dotnet.
crates/prek/tests/languages/main.rs Registers new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds integration tests for dotnet language behavior.
crates/prek/tests/common/mod.rs Adds an insta filter for dotnet version output.
crates/prek/src/store.rs Introduces a Dotnet tool bucket for caching/install locations.
crates/prek/src/languages/version.rs Adds parsing/dispatch for LanguageRequest::Dotnet.
crates/prek/src/languages/mod.rs Wires the dotnet language into install/health/run and capability flags.
crates/prek/src/languages/dotnet/mod.rs Adds dotnet language module exports.
crates/prek/src/languages/dotnet/version.rs Implements dotnet SDK version request parsing and matching.
crates/prek/src/languages/dotnet/installer.rs Implements system discovery + managed SDK download via dotnet-install scripts.
crates/prek/src/languages/dotnet/dotnet.rs Implements hook install/run logic and dotnet tool installation.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Installs dotnet in CI for the dotnet language test matrix entry.
.config/nextest.toml Adds a nextest profile to run only dotnet language tests.

Copilot AI review requested due to automatic review settings March 15, 2026 15:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET hook support to prek (pre-commit reimplementation), including SDK version selection, dotnet tool installation for additional_dependencies, and accompanying docs/CI/test coverage.

Changes:

  • Introduce a new dotnet language implementation with SDK discovery/download and tool installation.
  • Add integration + unit tests for .NET behavior and wire them into nextest + CI language matrix.
  • Update user documentation to reflect .NET support and configuration options.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/languages.md Documents .NET language support, language_version, and additional_dependencies.
crates/prek/tests/run.rs Updates invalid-config test to use swift now that dotnet supports deps.
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds end-to-end integration tests for .NET hooks and behaviors.
crates/prek/src/store.rs Adds ToolBucket::Dotnet for storing managed SDK assets.
crates/prek/src/languages/version.rs Adds LanguageRequest::Dotnet parsing and satisfaction checks.
crates/prek/src/languages/mod.rs Wires the dotnet language into install/health/run dispatch and capability flags.
crates/prek/src/languages/dotnet/version.rs Implements .NET language_version parsing (major/minor/patch + TFM-like forms).
crates/prek/src/languages/dotnet/mod.rs Introduces the dotnet language module structure/exports.
crates/prek/src/languages/dotnet/installer.rs Implements SDK discovery, managed install, and version querying for .NET.
crates/prek/src/languages/dotnet/dotnet.rs Implements hook install/run/health for .NET + dotnet tool installation.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Adds .NET setup step and includes dotnet in the language test matrix.
.config/nextest.toml Adds lang-dotnet nextest profile for dotnet-specific tests.

Copilot AI review requested due to automatic review settings March 15, 2026 15:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET hook support to prek (a Rust reimplementation of pre-commit) by introducing a dotnet language implementation that can resolve/install SDK versions and install .NET tools declared as hook dependencies.

Changes:

  • Implement dotnet language support: SDK version request parsing, SDK discovery/installation (system-first, then managed), and additional_dependencies via dotnet tool install --tool-path.
  • Add end-to-end language tests for .NET hooks and wire them into the language test suite.
  • Update docs and CI/nextest profiles to include dotnet.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/languages.md Documents new dotnet language support, language_version, and additional_dependencies format.
crates/prek/tests/run.rs Updates an “invalid additional_dependencies” test to use swift now that dotnet supports deps.
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds integration tests covering version selection, deps install, stderr capture, and env isolation.
crates/prek/src/store.rs Adds ToolBucket::Dotnet to store managed SDK installs under tools/dotnet.
crates/prek/src/languages/version.rs Adds LanguageRequest::Dotnet dispatch for parsing/satisfaction checks.
crates/prek/src/languages/mod.rs Wires Language::Dotnet into support lists, buckets, and install/run/health dispatch.
crates/prek/src/languages/dotnet/mod.rs Adds the dotnet language module exports (installer + version parsing).
crates/prek/src/languages/dotnet/version.rs Implements .NET SDK request parsing and matching logic.
crates/prek/src/languages/dotnet/installer.rs Implements system discovery + managed installation via official dotnet-install scripts.
crates/prek/src/languages/dotnet/dotnet.rs Implements hook install/run/health for .NET and installs tool deps into an env-local tool path.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant for hook execution.
.github/workflows/ci.yml Adds .NET setup step and includes dotnet in the language-test matrix.
.config/nextest.toml Adds a lang-dotnet nextest profile to run dotnet language tests.

Copilot AI review requested due to automatic review settings March 15, 2026 18:25
@snus-kin snus-kin force-pushed the feature/dotnet-support branch from 99bb4cc to a060d43 Compare March 15, 2026 18:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET hook support to prek, including SDK selection and dotnet tool installation, and wires it into the project’s language test matrix + documentation.

Changes:

  • Implement language: dotnet with language_version parsing and managed SDK installation fallback.
  • Support additional_dependencies by installing dotnet tools into an isolated --tool-path and exposing them via PATH at runtime.
  • Add dotnet language integration tests, nextest profile, CI setup, and update docs to reflect support.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
docs/languages.md Documents .NET support, language_version, and additional_dependencies behavior.
crates/prek/tests/run.rs Updates the “invalid additional_dependencies” test case to use swift now that dotnet supports deps.
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds end-to-end tests for dotnet SDK selection, tool install, and type filtering.
crates/prek/src/store.rs Adds a ToolBucket::Dotnet to store managed SDK installs.
crates/prek/src/languages/version.rs Adds DotnetRequest wiring into LanguageRequest parsing/satisfaction checks.
crates/prek/src/languages/mod.rs Enables dotnet as a supported language impl (install/run/health + buckets/version/deps support).
crates/prek/src/languages/dotnet/mod.rs Introduces the dotnet language module exports.
crates/prek/src/languages/dotnet/version.rs Implements dotnet language_version parsing + unit tests.
crates/prek/src/languages/dotnet/installer.rs Implements system discovery + managed SDK installation via dotnet-install scripts.
crates/prek/src/languages/dotnet/dotnet.rs Implements hook install/run/health for dotnet + tool installation logic.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Adds dotnet to the language-test matrix and installs .NET for those jobs.
.config/nextest.toml Adds lang-dotnet nextest profile for CI language tests.

Copilot AI review requested due to automatic review settings March 15, 2026 20:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET (language: dotnet) support to prek, aligning it with how pre-commit manages dotnet tool-based hooks while also adding SDK resolution/installation and CI coverage.

Changes:

  • Implement .NET language support with SDK discovery/managed installation and per-hook dotnet tool installation via additional_dependencies.
  • Add .NET version request parsing (language_version) and integrate it into the shared language-version dispatch.
  • Add integration tests and CI/nextest wiring for dotnet, plus documentation updates.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/languages.md Documents dotnet support, language_version, and additional_dependencies formats.
crates/prek/tests/run.rs Updates invalid-config test case to use swift (since dotnet now supports deps).
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds dotnet integration tests (SDK versions, deps install, stderr capture, etc.).
crates/prek/src/store.rs Adds a ToolBucket::Dotnet bucket for managed SDK storage.
crates/prek/src/languages/version.rs Wires DotnetRequest into LanguageRequest parsing/satisfaction checks.
crates/prek/src/languages/mod.rs Registers the dotnet language implementation and enables language_version support.
crates/prek/src/languages/dotnet/version.rs Implements parsing/handling of dotnet version requests (+ unit tests).
crates/prek/src/languages/dotnet/mod.rs Adds the dotnet language module structure and exports.
crates/prek/src/languages/dotnet/installer.rs Implements system/managed SDK discovery + dotnet-install based downloads.
crates/prek/src/languages/dotnet/dotnet.rs Implements install/run/health-check for dotnet hooks + tool installation logic.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Adds dotnet to the language-test matrix and installs .NET for those runs.
.config/nextest.toml Adds a lang-dotnet nextest profile.

@j178
Copy link
Owner

j178 commented Mar 15, 2026

Appreciate the great contributions, just a friendly reminder to take some rest too!

Copilot AI review requested due to automatic review settings March 16, 2026 15:03
@snus-kin snus-kin force-pushed the feature/dotnet-support branch from 916863f to cdd5ccb Compare March 16, 2026 19:04
Copilot AI review requested due to automatic review settings March 16, 2026 19:29
@snus-kin snus-kin force-pushed the feature/dotnet-support branch from cdd5ccb to 793b97e Compare March 16, 2026 19:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds first-class .NET (dotnet) language support to prek, including SDK resolution/installation and support for installing .NET tools as hook additional_dependencies, plus docs/CI updates to validate behavior.

Changes:

  • Add dotnet language implementation with SDK discovery + managed installation via official dotnet-install scripts, and PATH/DOTNET_ROOT wiring at runtime.
  • Support language_version parsing for .NET (major / major.minor / exact / netX.Y-style) and add a dedicated tool bucket for managed SDKs.
  • Add dotnet-focused integration tests and wire them into nextest profiles + CI.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/languages.md Documents dotnet support, language_version, and additional_dependencies format.
crates/prek/tests/run.rs Updates an “invalid config” snapshot to use swift now that dotnet supports additional deps.
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds end-to-end CLI tests for dotnet SDK selection, managed installs, tool deps, stderr capture, etc.
crates/prek/src/store.rs Adds ToolBucket::Dotnet for storing managed SDK installations.
crates/prek/src/languages/version.rs Wires LanguageRequest::Dotnet parsing/satisfaction into the generic language_version system.
crates/prek/src/languages/mod.rs Integrates dotnet into language dispatch and capability flags (version + additional deps).
crates/prek/src/languages/dotnet/version.rs Implements .NET language_version parsing + matching logic with unit tests.
crates/prek/src/languages/dotnet/mod.rs Declares dotnet submodules and re-exports.
crates/prek/src/languages/dotnet/installer.rs Implements SDK discovery + managed install using dotnet-install scripts; includes unit tests.
crates/prek/src/languages/dotnet/dotnet.rs Implements hook install/run/health-check for dotnet and tool dependency installation.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Installs .NET in CI for the dotnet language test matrix entry.
.config/nextest.toml Adds a lang-dotnet nextest profile filtering dotnet language tests.

Copilot AI review requested due to automatic review settings March 16, 2026 21:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class .NET hook support to prek, including SDK version management and dotnet tool-based additional_dependencies, plus CI + test coverage to validate behavior.

Changes:

  • Implement dotnet language with language_version parsing, SDK discovery/download via official install scripts, and tool installation via dotnet tool install --tool-path.
  • Wire dotnet into the language registry/version request plumbing and store tool buckets.
  • Add integration tests + nextest profile, and extend CI to provision .NET for the language test matrix.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/languages.md Documents .NET support, language_version, and additional_dependencies format.
crates/prek/tests/run.rs Updates an invalid-config test to use swift now that dotnet supports deps.
crates/prek/tests/languages/main.rs Registers the new dotnet language test module.
crates/prek/tests/languages/dotnet.rs Adds integration tests for SDK version selection, tool installs, and output behavior.
crates/prek/src/store.rs Adds a Dotnet tool bucket for managed SDK installs.
crates/prek/src/languages/version.rs Adds DotnetRequest plumbing into LanguageRequest.
crates/prek/src/languages/mod.rs Registers dotnet language implementation and capability flags.
crates/prek/src/languages/dotnet/version.rs Implements .NET language_version parsing + unit tests.
crates/prek/src/languages/dotnet/mod.rs Adds dotnet module wiring and re-exports.
crates/prek/src/languages/dotnet/installer.rs Implements system/managed SDK discovery + dotnet-install (sh/ps1) execution.
crates/prek/src/languages/dotnet/dotnet.rs Implements install/run/health-check and dotnet tool dependency installation.
crates/prek-consts/src/env_vars.rs Adds DOTNET_ROOT env var constant.
.github/workflows/ci.yml Installs .NET for the dotnet language test matrix job.
.config/nextest.toml Adds lang-dotnet profile for isolating dotnet language tests.

@snus-kin
Copy link
Author

Pretty happy with where this is now, will publish a chsharpier mirror and poke around a bit with a proper build of this tomorrow. Any help with Windows would be nice too since I don't have a box to hand.

@snus-kin
Copy link
Author

snus-kin commented Mar 17, 2026

If anyone wants to have a go, try with this config.

repos:
  - repo: https://github.com/snus-kin/mirrors-csharpier
    rev: v1.2.6
    hooks:
      - id: csharpier-format

Works pretty nice on my machine for now

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.

3 participants