Oakrey.CodeAnalyzers 1.0.0

dotnet add package Oakrey.CodeAnalyzers --version 1.0.0
                    
NuGet\Install-Package Oakrey.CodeAnalyzers -Version 1.0.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="Oakrey.CodeAnalyzers" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.CodeAnalyzers" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.CodeAnalyzers" />
                    
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 Oakrey.CodeAnalyzers --version 1.0.0
                    
#r "nuget: Oakrey.CodeAnalyzers, 1.0.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.
#:package Oakrey.CodeAnalyzers@1.0.0
                    
#: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=Oakrey.CodeAnalyzers&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.CodeAnalyzers&version=1.0.0
                    
Install as a Cake Tool

Oakrey.CodeAnalyzers

The Oakrey.CodeAnalyzers package provides a collection of Roslyn-based code analyzers designed to help .NET developers enforce best practices, improve code quality, and catch common issues early in the development process. These analyzers target a range of code patterns, from async usage to exception handling and code maintainability.

Features

  • Async and Task Usage

    • Detects and warns against the use of async void methods (AsyncVoidAnalyzer).
    • Ensures that methods accepting cancellation should use CancellationToken (MissingCancellationTokenAnalyzer).
  • Exception Handling

    • Flags general catch blocks that may hide errors (GeneralCatchAnalyzer).
    • Detects silent catch blocks that swallow exceptions without handling or logging (SilentCatchAnalyzer).
  • Code Maintainability

    • Identifies files containing multiple class declarations (MultipleClassesInOneFileAnalyzer).
    • Highlights the use of Thread.Sleep which can block threads and degrade performance (ThreadSleepAnalyzer).
    • Detects TODO and FIXME comments to help track technical debt (TodoFixMeAnalyzer).
  • Security and Reliability

    • Flags potential PII (Personally Identifiable Information) data patterns in code (PIIDataPatternAnalyzer).
    • Ensures regular expressions have timeouts to prevent ReDoS vulnerabilities (RegexTimeoutAnalyzer).

Installation

You can install the package via NuGet Package Manager, Package Manager Console or the .NET CLI.

NuGet Package Manager

  1. Open your project in Visual Studio.
  2. Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution....
  3. Search for Oakrey.CodeAnalyzers and click Install.

.NET CLI

Run the following command in your terminal:

dotnet add package Oakrey.CodeAnalyzers

Package Manager Console

Run the following command in your Package Manager Console:

Install-Package Oakrey.CodeAnalyzers

Requirements

  • .NET 8 or higher

Project Information

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the package.

License

This project is licensed under the MIT License. See the LICENSE file for details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Oakrey.CodeAnalyzers:

Package Downloads
Oakrey.ASRockService.Common

Shared contracts and data types for ASRockService, enabling .NET applications to interact with ASRock motherboard GPIO and power management features. Includes service interfaces and models for device and pin information. Designed for use in both client and server scenarios.

Oakrey.HardwareManager.Client.Common

A foundational .NET library providing shared abstractions, base classes, and utilities for building hardware client applications. Includes device and channel models, connection management, error handling, and serialization support for the Oakrey HardwareManager ecosystem.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 171 7/8/2025