Cake aliases should be marked with a category to be discovered more easily on https://cakebuild.net
Cause
An alias class without the CakeAliasCategory
attribute was found.
Rule Description
A violation of this rule occurs when there is a class that ends with Alias
or
Aliases
that have not been marked with a CakeAliasCategory
attribute.
This attribute is recommended to be used to document in which category the adding
is under.
How to fix violations
To fix a violation of this rule, ensure that there is a CakeAliasCategory
(namespace Cake.Core.Annotations
) available on every alias class.
A code fix is provided using the light bulb to make this easier.
How to suppress violations
It is not generally recommended to suppress this violation, and false flags should be reported in the respective repository.
Changing severity using .editorconfig
The severity (and thus suppression) can be changed by using the editorconfig file by using:
[*.cs]
dotnet_diagnostic.CBA0001.severity = none
Suppress in project file
You can suppress the warning by using the <NoWarn>
element in the csproj
project file.
<NoWarn>$(NoWarn);CBA0001</NoWarn>
NOTE: You may have to open and close the solution for the changes to take effect.
Suppressing in code
The violation can be suppressed in code using an attribute (either on class, or global)
[SuppressMessage("Documentation",
"CBA0001:Missing Cake Alias Category",
Justification = "False Positive")]
Or by using pragma
#pragma warning disable CBA0001 // Missing Cake Alias Category
#pragma warning restore CBA0001 // Missing Cake Alias Category