HellBrick.Diagnostics 3.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HellBrick.Diagnostics --version 3.1.0                
NuGet\Install-Package HellBrick.Diagnostics -Version 3.1.0                
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="HellBrick.Diagnostics" Version="3.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HellBrick.Diagnostics --version 3.1.0                
#r "nuget: HellBrick.Diagnostics, 3.1.0"                
#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.
// Install HellBrick.Diagnostics as a Cake Addin
#addin nuget:?package=HellBrick.Diagnostics&version=3.1.0

// Install HellBrick.Diagnostics as a Cake Tool
#tool nuget:?package=HellBrick.Diagnostics&version=3.1.0                

Nuget

install-package HellBrick.Diagnostics

What is this?

Just a small opinionated set of diagnostics and code fixes to automate routine checks and producing boilerplate code. Both diagnostics and code fixes assume the latest version of C#.

Diagnostics

HBConfigureAwait

A diagnostic that's reported when an instance of type that has a ConfigureAwait( bool ) method is awaited.

There are two corresponding code fixes for inserting ConfigureAwait( false ) or ConfigureAwait( true ) call into the awaited expression.

ConfigureAwait() code fix screenshot

HBEnforceReadOnly

A diagnostic that's reported when a private field is never mutated, but doesn't have a readonly modifier and adding it wouldn't introduce a breaking change.

A corresponding code fix marks the field as readonly.

Readonly field code fix screenshot

HBStructImmutableNonReadonly

A diagnostic that's reported when struct fields are never mutated, but the struct doesn't have a readonly modifier.

A corresponding code fix marks the struct as readonly.

Readonly struct code fix screenshot

HBStructEquatabilityMethodsMissing

A diagnostic that's reported when readonly struct doesn't provide all required equatability traits (implementing IEquatable, overriding Equals() and GetHashCode(), providing == and != operators).

A corresponding code fix generates the missing methods.

Struct equatability code fix screenshot

HBUnusedParameter

A diagnostic that's reported when a method contains a parameter that isn't used in the method body, unless the method is one of the obvious exception cases (is part of interface implementation, is a program entry point, etc.).

A corresponding code fix removes the parameter from the method definition and the corresponding argument from all its call sites.

Unused parameter code fix screenshot

HBUnusedSymbol

A diagnostic that's reported when a non-public member is never used.

A corresponding code fix removes the unused member.

Unused symbol code fix screenshot

HBMissingAccessModifier

A diagnostic that's reported for the classes and members that don't have explicit access modifiers.

A corresponding code fix adds default access modifier to the class or member definition.

Missing access modifier code fix screenshot

ValueTypeNullComparison

A diagnostic that's reported when an instance of value type is compared for (in)equality with null.

A corresponding code fix replaces null with default.

Value type == null code fix screenshot

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 1.3

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on HellBrick.Diagnostics:

Package Downloads
ZeroORM.Extensibility

Core package for ZeroORM developing. Contains main service interfaces for extending ZeroORM by adding new metadata sources, DB drivers and so on. Is not intended for linking directly in non-ZeroORM projects.

ZeroORM

ZeroORM core package containing all of the data-dealing methods

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on HellBrick.Diagnostics:

Repository Stars
HellBrick/AsyncCollections
A .NET library that contains a set of lock-free thread-safe collections designed to be used asynchronously.
Version Downloads Last updated
6.0.0 453 11/24/2023
5.0.2 518 9/23/2022
5.0.1 499 1/18/2022
5.0.0 474 1/17/2022
4.0.0 2,243 12/26/2019
3.3.0 1,278 3/24/2019
3.2.0 739 2/18/2019
3.1.1 7,235 6/24/2018
3.1.0 1,043 6/12/2018
3.0.2 1,283 4/18/2018
3.0.1 2,857 2/5/2018
3.0.0 1,900 1/8/2018
2.0.0 2,518 8/20/2017
1.7.1 1,072 1/17/2017
1.7.0 1,061 12/21/2016
1.6.0 1,290 7/23/2016
1.5.1 1,039 7/23/2016
1.5.0 1,181 3/7/2016
1.4.5 1,610 1/18/2016
1.4.4 1,154 12/22/2015
1.4.3 1,155 12/4/2015
1.4.2 1,491 10/4/2015
1.4.1 1,473 10/4/2015
1.4.0 1,181 9/27/2015
1.3.0 1,149 9/20/2015
1.2.1 1,147 9/20/2015
1.2.0 1,202 7/27/2015
1.1.0 1,172 7/25/2015
1.0.2 1,120 7/24/2015
1.0.1 1,539 7/13/2015
1.0.0 1,385 7/11/2015

v3.1.0:
     - Removed the unused references analyzer (it has never worked properly anyway)
     - Made generated GetHashCode() and Equals() less verbose
     - Fixed the unused parameter code fix to add the type arguments if they can no longer be inferred after removing the redundant argument
     - Updated GetHashCode() generator to respect var/int code style preference
     - Readonly modifier is now enforced on a non-mutated value type field if the type of the field is a readonly struct

     v3.0.2:
     - Fixed a false positive reported by the unused parameter analyzer for an interface method declaration that has a parameter with a default value

     v3.0.1:
     - Fixed unused parameter analyzer to examine base calls and expression bodies properly
     - Fixed unused parameter analyzer not to suggest removing `this` parameter from extension methods
     - Fixed unused member analyzer to recognize `nameof( Method )` references

     v3.0.0:
     - Added an analyzer that forces immutable structs to have readonly modifier
     - Struct equatability analyzer has been changed to ignore structs that don't have a readonly modifier
     - Fields of non-readonly structs are no longer enforced to be readonly
     - Struct equatability diagnostics have new shared ID that allows suppressing them all with a single #pragma
     - Extended ConfigureAwait() analyzer to support arbitrary awaitable types

     v2.0.0:
     - Migrated to Roslyn 2.0
     - Updated analyzers and code fixes to respect C# 7.1

     v1.7.1:
     - fixed an exception caused by the Roslyn type resolve bug

     v1.7.0:
     - an analyzer that detects struct null comparison

     v1.6.0:
     - an analyzer that detects unused method parameters

     v1.5.1:
     - equality and mutability warnings are no longer reported for the struct enumerators
     - internal members are no longer considered unused if assembly has [InternalsVisibleTo] attribute
     - private members referenced from other partial class definitions are no longer considered unused
     - all analyzers use default heuristics to skip generated files

     v1.5.0:
     - an analyzer that detects unused class members (private and internal only)

     v1.4.5:
     - disabled formatting analyzer until it can be re-implemented properly

     v1.4.4:
     - suppressed another format of auto-generated comments

     v1.4.3:
     - changed diagnsotic IDs to provide compatibility with VS 2015 update 1

     v1.4.2:
     - an attempt to fix the FormattingAnalyzer warning issued on VS loading it from a nuget package

     v1.4.1:
     - merged in the analyzer that enforces ConfigureAwait()
     - fixed a bunch of bugs

     v1.4.0:
     - an analyzer that enforces explicit access modifiers
     - an analyzer that enforces immutability and equatability on structs
     - all analyzers ignore auto-generated code

     v1.3.0:
     - an analyzer that enforces the proper code formatting
     - a refactoring to convert one-line properties to expression-bodied properties

     v1.2.1:
     - fixed Nuget package installation issues
     - readonly modifier can now be enforced on fields of primitive types
     - var can be converted to explicit type inside the using declaration block
     - var can no longer be converted if it's generic type with anonymous arguments
     - conversion to expression-bodied member is no longer suggested for the methods that can't be converted
     - the reference is no longer considered unused if a method that returns a type declared in it is invoked

     v1.2.0:
     - a refactoring to convert String.Format() call to an interpolated string
     - a refactoring to convert var to explicit type name and back

     v1.1.0:
     - unused project references are reported to the error/information list

     v1.0.2:
     - upgraded to VS 2015 RTM

     v1.0.1:
     - readonly modifier is no longer enforced on value type fields (to avoid SpinLock-like issues)

     v1.0.0:
     - enforce readonly modifier on fields
     - convert one-line methods to expression-bodied methods