HoneyDrunk.Standards 0.2.9

dotnet add package HoneyDrunk.Standards --version 0.2.9
                    
NuGet\Install-Package HoneyDrunk.Standards -Version 0.2.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HoneyDrunk.Standards" Version="0.2.9">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HoneyDrunk.Standards" Version="0.2.9" />
                    
Directory.Packages.props
<PackageReference Include="HoneyDrunk.Standards">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HoneyDrunk.Standards --version 0.2.9
                    
#r "nuget: HoneyDrunk.Standards, 0.2.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HoneyDrunk.Standards@0.2.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HoneyDrunk.Standards&version=0.2.9
                    
Install as a Cake Addin
#tool nuget:?package=HoneyDrunk.Standards&version=0.2.9
                    
Install as a Cake Tool

HoneyDrunk.Standards

Validate License: MIT .NET 10

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.Sleep is banned in test projects via HD0051

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 - _fieldName convention
  • var usage - Prefer var everywhere
  • Minimal braces - Only required for multi-line blocks
  • Async suffix - GetUserAsync naming
  • 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=false
  • IsTestProject=true
  • xUnit 2.9.3
  • xunit.runner.visualstudio 2.8.2
  • Microsoft.NET.Test.Sdk 18.5.1
  • NSubstitute 5.3.0
  • AwesomeAssertions 9.4.0
  • coverlet.collector 10.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:

  • await the 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:

  1. Read CONVENTIONS.md for coding standards
  2. Open an issue for discussion before major changes
  3. Include tests for new rules or features
  4. 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


<div align="center">

Built with ๐Ÿฏ by HoneyDrunk Studios

Documentation โ€ข Sample Project โ€ข Issues โ€ข Contact

</div>

There are no supported framework assets in this package.

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
Loading failed

v0.2.9: Keep Standards aligned with the fixed ADR-0047 test-stack package.