altcode.gendarme-tool 2022.1.20.8043-pre-release

This is a prerelease version of altcode.gendarme-tool.
There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet tool install --global altcode.gendarme-tool --version 2022.1.20.8043-pre-release
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local altcode.gendarme-tool --version 2022.1.20.8043-pre-release
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=altcode.gendarme-tool&version=2022.1.20.8043-pre-release&prerelease
nuke :add-package altcode.gendarme-tool --version 2022.1.20.8043-pre-release

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.
  • 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.
  • Because they use obsolescing functions not present in netstandard2.0 the following Gendarme.Rules.Security.Cas rules are not implemented in the global tool version (so if this is relevant to you, use the .net Framework build):
    • 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

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. A few failures are due to the API changes in .netstandard compared with the .net Framework. 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
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2023.12.27.19054 324 12/27/2023
2023.8.26.15512 349 8/26/2023
2023.1.22.12221 505 1/22/2023
2023.1.21.13293 295 1/21/2023
2022.12.6.7345 440 12/6/2022
2022.5.17.8260 1,611 5/17/2022

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


2022.1.20.8xxx-pre-release
• Fix false positives in globalization rules PreferIFormatProviderOverrideRule and PreferStringComparisonOverrideRule in a net6.0-only environment

2022.1.19.15132-pre-release
• Fix intermittent/environmentally dependent bugs in --
  ◦ Globalization rules PreferIFormatProviderOverrideRule and PreferStringComparisonOverrideRule
  ◦ Correctness rule BadRecursiveInvocationRule

2022.1.17.12282-pre-release
• net40 build removed; the Framework tool now uses shared netstandard2.0 assemblies with a net472 executable.  This also means that the stale code access security rules are now removed --
  ◦ AddMissingTypeInheritanceDemandRule
  ◦ DoNotExposeMethodsProtectedByLinkDemandRule
  ◦ DoNotReduceTypeSecurityOnMethodsRule
  ◦ SecureGetObjectDataOverridesRule
• In the text output, include a specimen global suppression attribute for each issue (F# syntax, ready to copy and paste; for other languages, tweak the [<>] part of the declaration).  This is for convenience when dealing with 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
Global Suppression Attribute:
[assembly: SuppressMessage(Gendarme.Rules.Correctness,
                           MethodCanBeMadeStaticRule,
                           Scope = member, // MethodDefinition
                           Target = ParameterNamesShouldMatch.Handler::ShowMessage(a,System.String),
                           Justification = )]

• Fixes DoNotLockOnThisOrTypesRule for current C# compiler IL generation
• Reenable several rules omitted in previous builds
  ◦ bad practice rules AvoidNullCheckWithAsOperatorRule and DoNotDecreaseVisibilityRule
  ◦ design rule DoNotDeclareSettersOnCollectionPropertiesRule (excluding the PermissionSet exemption)
  ◦ exception rule DoNotThrowInNonCatchClausesRule
  ◦ globalization rules PreferIFormatProviderOverrideRule and PreferStringComparisonOverrideRule

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