altcode.gendarme 2022.5.17.8260

Install-Package altcode.gendarme -Version 2022.5.17.8260
dotnet add package altcode.gendarme --version 2022.5.17.8260
<PackageReference Include="altcode.gendarme" Version="2022.5.17.8260" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add altcode.gendarme --version 2022.5.17.8260
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: altcode.gendarme, 2022.5.17.8260"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install altcode.gendarme as a Cake Addin
#addin nuget:?package=altcode.gendarme&version=2022.5.17.8260

// Install altcode.gendarme as a Cake Tool
#tool nuget:?package=altcode.gendarme&version=2022.5.17.8260
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

altcode.gendarme/altcode.gendarme-tool

A Mono.Gendarme fork, built against a recent Mono.Cecil version, one that can load assemblies built with current compilers.

Features

  • Can load .net core assemblies
    • Will search the nuget cache for dependencies, though this can take some time as an alternative to using dotnet publish to get all the code you want to analyse in one place.
    • Updated for modern C# dialect e.g. allow discard _ as a variable name
    • Bug fixes and updates for current compiler generated IL
  • Will load debug information from embedded symbols or actual .pdb files if available even on non-Windows platforms.
    • The main impact is that the AvoidLongMethodsRule works by LoC and not IL against .net core code on all platforms.
  • Depending whether the Framework or dotnet tool version is used, the results may differ when faced with the same assembly, because of the different runtime being consulted
    • e.g. several types marked [Serializable] in the Framework are not so marked at dotnet, so serialization rules will give different answers
  • Because they use obsolescing functions not present in netstandard2.0 the following Gendarme.Rules.Security.Cas rules are only present in the Framework tool build, under the Obsolete.Rules.Security.Cas name:
    • AddMissingTypeInheritanceDemandRule
    • DoNotExposeMethodsProtectedByLinkDemandRule
    • DoNotReduceTypeSecurityOnMethodsRule
    • SecureGetObjectDataOverridesRule
  • The obsolete Gendarme.Rules.Portability.MonoCompatibilityReviewRule is not implemented in this fork.
  • DefineAZeroValueRule does not trigger for non-int32 enums that have a suitably typed zero value. This rule should not also be doing the job of EnumsShouldUseInt32Rule
  • Due to IL changes UseIsOperatorRule has been tuned to avoid false positives at the cost of missing some failure cases
  • New rules/categories
    • AltCode.Rules.General.AvoidAssemblySemanticVersionMismatchRule to insist that the API contract (major, minor, and optionally build if defined for the assembly) match, but the lesser facets, revision and possibly build are free.
    • AltCode.Rules.General.JustifySuppressionRule to check the Justification property on SuppressMessage attribute
    • AltCode.Rules.General.PreferStrongNamedAssembliesRule to replace deprecated/withdrawn FxCop rule Microsoft.Design#CA2210
    • AltCode.Rules.PowerShell.UseOnlyStandardVerbsRule to replace "Microsoft.PowerShell#PS1001:UseOnlyStandardVerbs"
    • AltCode.Rules.PowerShell.DefineCmdletInTheCorrectNamespaceRule to replace "Microsoft.PowerShell#PS1011:DefineCmdletInTheCorrectNamespace"
    • Gendarme.Rules.Serialization.RelaxedMarkAllNonSerializableFieldsRule to ignore F# compiler generated closures
    • Gendarme.Rules.Smells.RelaxedAvoidCodeDuplicatedInSameClassRule to ignore some trivial cases e.g. argument null checks
  • Reinstated rules
    • Gendarme.Rules.BadPractice.AvoidNullCheckWithAsOperatorRule
    • Gendarme.Rules.BadPractice.DoNotDecreaseVisibilityRule
    • Gendarme.Rules.Correctness.DeclareEventsExplicitlyRule
    • Gendarme.Rules.Design.DoNotDeclareSettersOnCollectionPropertiesRule (excluding the PermissionSet exemption)
    • Gendarme.Rules.Exceptions.DoNotThrowInNonCatchClausesRule
    • Gendarme.Rules.Globalization.PreferIFormatProviderOverrideRule
    • Gendarme.Rules.Globalization.PreferStringComparisonOverrideRule
  • In the text output, include a specimen global suppression attribute for each issue, for convenience when dealing with remaining intractable issues e.g. arising from code generation
    • While Scope is not heeded by the Gendarme process, it's there to placate other consumers (which will ignore the foreign rule); the comment indicates the corresponding object type within the Gendarme analysis in case they should ever be out of line.
    • The syntax and punctuation of the Target with regards to nested types and special names is as Gendarme expects, which differs somewhat from FxCop in annoying details
    • The emitted section looks like this:
Global Suppression Attribute:
[<assembly: SuppressMessage("Gendarme.Rules.Correctness",
                            "MethodCanBeMadeStaticRule",
                            Scope = "member", // MethodDefinition
                            Target = "ParameterNamesShouldMatch.Handler::ShowMessage(a,System.String)",
                            Justification = "")>]

Known Issues

Not all the classic Gendarme unit tests currently pass. In the main, these failures are due to the Roslyn compiler producing different IL than the original C# compiler did. In production these will typically manifest as false negatives.

Changes made for F# support

The F# compiler generates a large amount of code that does not conform to these rules, particularly with closures. A full list for the most recent release is presented here.

Badges

Build AppVeyor Build status Build history
GitHub CI Build history
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2022.5.17.8260 7 5/17/2022
2022.5.15.11273 52 5/15/2022
2022.2.17.8350 239 2/17/2022

This build from https://github.com/SteveGilham/Gendarme/tree/aced64afe552aa5db166f5575a640099382e1205


2022.5.17.82xx
• Fix false positives for DoNotThrowInNonCatchClausesRule for try/when/catch cases that throw from the catch

For previous releases, go here -- https://github.com/SteveGilham/Gendarme/blob/trunk/ReleaseNotes%20-%20Previously.md