HoneyDrunk.Standards
0.4.4
dotnet add package HoneyDrunk.Standards --version 0.4.4
NuGet\Install-Package HoneyDrunk.Standards -Version 0.4.4
<PackageReference Include="HoneyDrunk.Standards" Version="0.4.4"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="HoneyDrunk.Standards" Version="0.4.4" />
<PackageReference Include="HoneyDrunk.Standards"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add HoneyDrunk.Standards --version 0.4.4
#r "nuget: HoneyDrunk.Standards, 0.4.4"
#:package HoneyDrunk.Standards@0.4.4
#addin nuget:?package=HoneyDrunk.Standards&version=0.4.4
#tool nuget:?package=HoneyDrunk.Standards&version=0.4.4
HoneyDrunk.Standards
Repository layout
Open HoneyDrunk.Standards.slnx from the repository root. Production projects live in src/, test and canary projects in tests/, and examples in samples/ where present. Shared build configuration stays at the root; project names, namespaces and package identities are unchanged. Existing documentation and release-history locations are retained.
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 - โ
Architecture Rules -
HD0101-HD0106: entities end withEntityand are mapped explicitly, only data services touch the database, services stay small - โ
Comment Rules -
HD0110/HD0111: no commented-out code, no untracked TODOs
All of this happens automatically when you add the package. No manual configuration needed.
Unity projects
Use the opt-in Unity profile for Unity 6 / Roslyn 4.3. It builds a pinned analyzer distribution with Unity import metadata and per-assembly rulesets; the server NuGet package below is not a Unity integration.
Repository tools
tools/ holds standard-library Python checks that a repository runs from a pinned Standards commit: check_file_layout.py (file size and folder layout against a ratcheting baseline) and check_new_diagnostics.py (analyzer rules that fail only on new and changed code). See File Size and Folder Layout.
๐ Quick Start
Installation
Add the package to your project:
<ItemGroup>
<PackageReference Include="HoneyDrunk.Standards" Version="0.4.4" 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 - Architecture rules - See Enforced Architecture Rules
โ๏ธ 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.4.4" PrivateAssets="all" />
<PackageReference Include="HoneyDrunk.Standards.Tests" Version="0.4.4" 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.visualstudio4.0.1Microsoft.NET.Test.Sdk18.11.0NSubstitute6.2.0AwesomeAssertions9.6.0coverlet.collector10.1.0
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.
The 0.3.0 refresh retains the custom analyzer's Roslyn compiler API baseline at 4.14.0 for earlier .NET 10 compiler hosts. The existing StyleCop 1.2 beta remains in place because the stable release is older. Other analyzer and test-tool dependencies use the current stable releases recorded above and in the project files.
๐ 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
# Build and pack
dotnet pack -c Release -o ./artifacts
# Test in your project
dotnet add package HoneyDrunk.Standards --source ./artifacts --version 0.4.4
๐ 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.slnx
# Build
dotnet build HoneyDrunk.Standards.slnx -c Release
# Pack
dotnet pack src/HoneyDrunk.Standards/HoneyDrunk.Standards.csproj -c Release -o ./artifacts
# Test in Consumer.Sample
cd samples/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.4.4 | 2,292 | 11/6/2026 |
| 0.4.3 | 427 | 11/5/2026 |
| 0.4.2 | 112 | 11/5/2026 |
| 0.4.1 | 229 | 11/1/2026 |
| 0.4.0 | 175 | 10/18/2026 |
| 0.3.0 | 2,823 | 9/26/2026 |
| 0.2.9 | 5,623 | 5/22/2026 |
| 0.2.8 | 156 | 5/22/2026 |
| 0.2.7 | 1,574 | 4/12/2026 |
| 0.2.6 | 793 | 11/22/2025 |
| 0.2.5 | 865 | 11/18/2025 |
| 0.2.4 | 821 | 11/17/2025 |
| 0.2.3 | 750 | 11/13/2025 |
| 0.2.2 | 713 | 11/13/2025 |
| 0.2.1 | 705 | 11/13/2025 |
| 0.2.0 | 710 | 11/13/2025 |
| 0.1.10 | 712 | 11/13/2025 |
| 0.1.9 | 722 | 11/13/2025 |
| 0.1.8 | 702 | 11/12/2025 |
| 0.1.7 | 710 | 11/12/2025 |
v0.4.4: Refresh StyleCop to the compatible 1.3.171-beta release and embed its direct-package analyzer payload; preserve compiler profiles and rule severities.