HoneyDrunk.Standards
0.2.9
dotnet add package HoneyDrunk.Standards --version 0.2.9
NuGet\Install-Package HoneyDrunk.Standards -Version 0.2.9
<PackageReference Include="HoneyDrunk.Standards" Version="0.2.9"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="HoneyDrunk.Standards" Version="0.2.9" />
<PackageReference Include="HoneyDrunk.Standards"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add HoneyDrunk.Standards --version 0.2.9
#r "nuget: HoneyDrunk.Standards, 0.2.9"
#:package HoneyDrunk.Standards@0.2.9
#addin nuget:?package=HoneyDrunk.Standards&version=0.2.9
#tool nuget:?package=HoneyDrunk.Standards&version=0.2.9
HoneyDrunk.Standards
Build-transitive standards package enforcing shared conventions, analyzers, and deterministic builds across HoneyDrunk Studios repositories.
๐ฆ What Is This?
HoneyDrunk.Standards is a zero-configuration NuGet package that automatically applies:
- โ StyleCop Analyzers - Consistent naming and ordering conventions
- โ Roslyn Analyzers - Performance, reliability, and security checks
- โ EditorConfig - IDE-agnostic formatting rules
- โ Deterministic Builds - Reproducible builds across machines
- โ Nullable Reference Types - Enforced null safety
- โ Warnings as Errors - Quality gate in CI/CD
- โ
ADR-0047 Test Stack - xUnit v2, NSubstitute, AwesomeAssertions, and coverlet for
*.Tests.*projects - โ Coverage Templates - Tiered coverlet runsettings for ADR-0047 / ADR-0036 coverage targets
- โ
Test Flake Guardrail -
Thread.Sleepis banned in test projects viaHD0051
All of this happens automatically when you add the package. No manual configuration needed.
๐ Quick Start
Installation
Add the package to your project:
<ItemGroup>
<PackageReference Include="HoneyDrunk.Standards" Version="0.1.0" PrivateAssets="all" />
</ItemGroup>
Important: Always include PrivateAssets="all" to prevent transitive dependencies.
Verify It Works
dotnet build
You should see:
- โ Analyzer warnings/errors if code violates standards
- โ StyleCop rules enforced
- โ EditorConfig formatting applied
๐ Documentation
| Document | Description |
|---|---|
| CONVENTIONS.md | Coding standards, naming rules, and architectural patterns |
| ADOPTION.md | How to adopt, customize, and troubleshoot |
| Consumer.Sample | Working example with compliant and violation code |
๐ฏ Features
๐ Analyzers Included
| Analyzer | Purpose | Rules |
|---|---|---|
| StyleCop.Analyzers | Naming, ordering, documentation | 100+ SA rules |
| Microsoft.CodeAnalysis.NetAnalyzers | Performance, reliability, security | 200+ CA rules |
| IDE Analyzers | Code style, modernization | 50+ IDE rules |
๐ Enforced Standards
- File-scoped namespaces -
namespace MyApp;(C# 10+) - Private field prefixes -
_fieldNameconvention - var usage - Prefer
vareverywhere - Minimal braces - Only required for multi-line blocks
- Async suffix -
GetUserAsyncnaming - XML documentation - Required for public APIs
- Nullable annotations - Explicit
?for nullability
โ๏ธ Build-Time Features
- Deterministic builds - Same source = same binary
- CI mode auto-detection - Optimized for GitHub Actions, Azure Pipelines
- Warnings as errors - Fail builds on analyzer warnings
- Nullable reference types - Catch null bugs at compile time
๐งช ADR-0047 Test Defaults
Test projects should reference both packages:
<ItemGroup>
<PackageReference Include="HoneyDrunk.Standards" Version="0.2.9" PrivateAssets="all" />
<PackageReference Include="HoneyDrunk.Standards.Tests" Version="0.2.9" PrivateAssets="all" />
</ItemGroup>
HoneyDrunk.Standards.Tests carries the NuGet dependencies because package buildTransitive props cannot reliably add PackageReference items during restore. Keep the reference simple: use PrivateAssets="all", but do not copy the analyzer-package IncludeAssets pattern onto this metapackage because consumers need compile/runtime assets from the test-stack dependencies. Projects whose names match the Grid test convention (*.Tests.Unit, *.Tests.Integration, *.Tests.Integration.Containers, *.Tests.E2E, *.Tests.Benchmarks) receive:
IsPackable=falseIsTestProject=true- xUnit
2.9.3 xunit.runner.visualstudio2.8.2Microsoft.NET.Test.Sdk18.5.1NSubstitute5.3.0AwesomeAssertions9.4.0coverlet.collector10.0.1
Runtime projects must reference only HoneyDrunk.Standards, so they do not receive these test packages. Moq and FluentAssertions are intentionally absent per ADR-0047 D2.
๐ Coverage Runsettings Templates
Copy the matching template from the package's buildTransitive assets to the Node repo root as coverlet.runsettings, then run:
dotnet test --settings coverlet.runsettings
| Node tier | Template | Line | Branch | Behavior |
|---|---|---|---|---|
| Tier 0 | coverlet.tier0.runsettings |
85% | 80% | Hard gate |
| Tier 1 | coverlet.tier1.runsettings |
75% | 70% | Hard gate |
| Tier 2 | coverlet.tier2.runsettings |
60% | 55% | Warn-only; CI emits the warning |
| Untiered | none | none | none | No coverage gate |
Tier 2 omits coverlet thresholds because coverlet thresholds fail the test run; the CI job owns the warning posture. All first adoptions have ADR-0047's 30-day advisory grace period before hard gates become blocking. Forward-declared Nodes such as Notify Cloud, Memory, Knowledge, Flow, and Evals use the template for their tier when scaffolded.
๐ซ Test Thread.Sleep Ban
Thread.Sleep is forbidden in *.Tests.* projects by the HoneyDrunk analyzer rule HD0051. The rule is build-breaking for test projects only and covers both Thread.Sleep(int) and Thread.Sleep(TimeSpan).
Use one of these instead:
awaitthe async operation- polling primitives with explicit timeouts
- synchronously-completing fakes
Runtime projects are not flagged by this rule.
๐ ๏ธ Configuration
Opt-Out of Features
All behavior can be customized via MSBuild properties:
<PropertyGroup>
<HD_EnableAnalyzers>false</HD_EnableAnalyzers>
<HD_UseStyleCop>false</HD_UseStyleCop>
<HD_TreatWarningsAsErrors>false</HD_TreatWarningsAsErrors>
</PropertyGroup>
Suppress Specific Rules
<PropertyGroup>
<NoWarn>$(NoWarn);CA1062;SA1633</NoWarn>
</PropertyGroup>
Override Language Features
<PropertyGroup>
<LangVersion>12.0</LangVersion>
<Nullable>disable</Nullable>
</PropertyGroup>
๐ Included Rules
Enabled by Default
| Category | Example Rules | Severity |
|---|---|---|
| Naming | CA1715 (interface prefix), SA1309 (field prefix) | Warning |
| Performance | CA1827 (use Any()), CA1846 (use AsSpan()) | Warning |
| Reliability | CA2000 (dispose objects), CA2016 (forward CancellationToken) | Warning |
| Security | CA2100 (SQL injection), CA5* (crypto) | Warning |
| Style | SA1200 (using order), IDE0161 (file-scoped namespace) | Warning |
Disabled Rules (With Rationale)
| Rule | Why Disabled | When to Enable |
|---|---|---|
| CA1031 | General exception handling needed at boundaries | Enable in business logic |
| CA1303 | Localization not required for internal tools | Enable for customer-facing apps |
| CA1707 | Underscores improve test method readability | Keep disabled for tests |
| CA1848 | LoggerMessage delegates add boilerplate | Opt-in for performance-critical paths |
| CA2007 | ConfigureAwait not needed in modern .NET | Enable for libraries supporting .NET Framework |
| SA1503 | Minimize braces (only when multi-line) | Override if you prefer always-braces |
See CONVENTIONS.md for full rationale.
๐งช Testing & Validation
Sample Project
The Consumer.Sample project demonstrates:
- โ Compliant code examples
- โ Commented-out violations you can uncomment to test
- ๐ README with step-by-step testing instructions
Local Testing
# Clone the repository
git clone https://github.com/HoneyDrunkStudios/HoneyDrunk.Standards.git
cd HoneyDrunk.Standards/HoneyDrunk.Standards
# Build and pack
dotnet pack -c Release -o ./artifacts
# Test in your project
dotnet add package HoneyDrunk.Standards --source ./artifacts --version 0.1.0
๐ CI/CD Integration
GitHub Actions
The package auto-detects CI environments:
- name: Build with standards
run: dotnet build -c Release
# ContinuousIntegrationBuild=true automatically enabled
# TreatWarningsAsErrors=true enforced
Explicit CI Mode
Force CI mode locally:
dotnet build /p:ContinuousIntegrationBuild=true /p:TreatWarningsAsErrors=true
๐ค Contributing
Contributions are welcome! Please:
- Read CONVENTIONS.md for coding standards
- Open an issue for discussion before major changes
- Include tests for new rules or features
- Update documentation
Development Workflow
# Restore dependencies
dotnet restore HoneyDrunk.Standards.sln
# Build
dotnet build HoneyDrunk.Standards.sln -c Release
# Pack
dotnet pack HoneyDrunk.Standards/HoneyDrunk.Standards.csproj -c Release -o ./artifacts
# Test in Consumer.Sample
cd Consumer.Sample
dotnet build
๐ License
This project is licensed under the MIT License.
๐ About HoneyDrunk Studios
HoneyDrunk.Standards is part of the Hive ecosystem - a collection of tools, libraries, and standards for building high-quality .NET applications.
Other Projects:
- ๐ง HoneyDrunk.Build (coming soon) - Build tooling and SourceLink automation
- ๐ง HoneyDrunk.GitHooks (coming soon) - Git hooks for commit message validation
๐ Support
- Questions: Email us at contact@honeydrunkstudios.com
- Bugs: File an issue
- Feature Requests: Open an issue with the
enhancementlabel
<div align="center">
Built with ๐ฏ by HoneyDrunk Studios
Documentation โข Sample Project โข Issues โข Contact
</div>
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HoneyDrunk.Standards:
| Package | Downloads |
|---|---|
|
HoneyDrunk.Standards.Tests
ADR-0047 test-stack package for HoneyDrunk test projects: xUnit v2, NSubstitute, AwesomeAssertions, coverlet, and HoneyDrunk.Standards. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.9 | 2,274 | 5/22/2026 |
| 0.2.8 | 112 | 5/22/2026 |
| 0.2.7 | 1,526 | 4/12/2026 |
| 0.2.6 | 528 | 11/22/2025 |
| 0.2.5 | 638 | 11/18/2025 |
| 0.2.4 | 597 | 11/17/2025 |
| 0.2.3 | 526 | 11/13/2025 |
| 0.2.2 | 487 | 11/13/2025 |
| 0.2.1 | 484 | 11/13/2025 |
| 0.2.0 | 484 | 11/13/2025 |
| 0.1.10 | 485 | 11/13/2025 |
| 0.1.9 | 495 | 11/13/2025 |
| 0.1.8 | 480 | 11/12/2025 |
| 0.1.7 | 483 | 11/12/2025 |
| 0.1.6 | 385 | 11/8/2025 |
| 0.1.5 | 347 | 11/8/2025 |
| 0.1.4 | 352 | 11/8/2025 |
| 0.1.3 | 362 | 11/8/2025 |
| 0.1.2 | 358 | 11/8/2025 |
| 0.1.1 | 358 | 11/8/2025 |
v0.2.9: Keep Standards aligned with the fixed ADR-0047 test-stack package.