Skip to main content

foundry-habit-hooks-dotnet

The C#/.NET Habit Hooks plugin: wraps dotnet build with SonarAnalyzer.CSharp active, and maps its structural warnings to habit-hooks smell kinds.

It is the direct analog of the Java plugin's pmd sensor. Where a plain dotnet build -warnaserror can only fail the build on any warning, this feeds the warnings through habit-hooks' snooze index, so an existing backlog is grandfathered and only new structural debt gates.

Install

pip install habit-hooks foundry-habit-hooks-dotnet

Installing a plugin does not switch it on. Name it in plugins:

# .habit-hooks/config.toml
plugins = ["dotnet", "generic"]

Requirements

  • The .NET SDK (dotnet on PATH). winget install Microsoft.DotNet.SDK.9
  • The target project references SonarAnalyzer.CSharp as an analyzer package.

The plugin ships a default ruleset that enables the structural rules (SonarAnalyzer ships them off by default) and passes it with -p:CodeAnalysisRuleSet. A project that wants its own thresholds or rule set overrides it:

[sensors.dotnet-build]
args = ["-p:CodeAnalysisRuleSet=path/to/your.ruleset"]

Rule mapping

Sonar rule Smell
S138 (method length) oversized-function
S1541 (cyclomatic complexity) high-complexity
S3776 (cognitive complexity) high-complexity
S107 (too many parameters) too-many-parameters
S104 (file length) oversized-file

Thresholds are SonarAnalyzer's own defaults. A Sonar rule not in the table is not reported.

Versioning

Released in lockstep with habit-hooks core: the plugin version tracks the core's major.minor so the sensor protocol it builds against never drifts. The mise HABIT_HOOKS_VERSION variable pins both together.

Metadata

Release files for foundry-habit-hooks-dotnet 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foundry-habit-hooks-dotnet 1.5.0
File Size Uploaded
foundry_habit_hooks_dotnet-1.5.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foundry-habit-hooks-dotnet 1.5.0
File Interpreter ABI Platform
foundry_habit_hooks_dotnet-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / foundry_habit_hooks_dotnet-1.5.0.tar.gz

Download URL foundry_habit_hooks_dotnet-1.5.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
05ad001436c2b5d309d14a17fda59ecdb028d89c773293f1fc7c58f9bcfe1eb8
BLAKE2b-256 checksum
How to use checksums
2224032ed788d48dcd86d5a1454439c4c60f907c7ae791f4b1741a6320fc46a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / foundry_habit_hooks_dotnet-1.5.0-py3-none-any.whl

Download URL foundry_habit_hooks_dotnet-1.5.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ce92819b2a98c4d3ab38a16163b332afdf2b3bce7da8ddfd9544bcf492030ca
BLAKE2b-256 checksum
How to use checksums
0c8ea9ab2d63f611edb24f3a47727e6cc709296a95ee821c7763d86cb91037c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page