Skip to content

CA1822 - Support for TUnit #7453

Open
@viceroypenguin

Description

Analyzer

Diagnostic ID: CA1822

Describe the improvement

Currently, CA1822 provides exclusions when attributes from XUnit, MSTest, and NUnit are applied to a method. I am in the process of migrating to TUnit, a new testing framework; but since it does not use the same attributes, [Test] methods are being flagged by CA1822.

It would be helpful to either/both:

  1. have a parameter in the .editorconfig to add additional attributes to the skipped list
  2. add TUnit.Core.TestAttribute, TUnit.Core.BeforeAttribute, TUnit.Core.BeforeEveryAttribute, TUnit.Core.AfterAttribute, TUnit.Core.AfterEveryAttribute to the exclusion list.

Describe suggestions on how to achieve the rule

  1. Am not familiar enough with the process to provide clear directions on how to improve. Expected .editorconfig might look something like:
dotnet_code_quality.CA1822.excluded_attributes = T:TUnit.Core.TestAttribute, T:TUnit.Core.BeforeAttribute

Additional context

TUnit documentation: https://thomhurst.github.io/TUnit/docs/intro

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions