Skip to content

Commit

Permalink
fix: Removed code smell - S3376 (#166)
Browse files Browse the repository at this point in the history
* fix: Removed code smell - S3376

* fix: Code style
  • Loading branch information
samtrion authored Aug 30, 2023
1 parent ce0649c commit fb48320
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.NUnit/BugAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as Bug, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class BugAttribute : CategoryIdAttributeBase
public sealed class BugAttribute : CategoryIdBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="BugAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.NUnit/EpicAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as Epic, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class EpicAttribute : CategoryIdAttributeBase
public sealed class EpicAttribute : CategoryIdBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="EpicAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.NUnit/FeatureAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as Feature, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class FeatureAttribute : CategoryIdAttributeBase
public sealed class FeatureAttribute : CategoryIdBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="FeatureAttribute"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,31 @@
/// Abstract class implementation.
/// Extends <see cref="CategoryAttribute"/> with an additional property <see cref="Id"/>.
/// </summary>
public abstract class CategoryIdAttributeBase : CategoryAttribute, IApplyToTest
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Style",
"IDE1006:Naming Styles",
Justification = "As designed."
)]
public abstract class CategoryIdBaseAttribute : CategoryAttribute, IApplyToTest
{
/// <summary>
/// Gets the Id
/// </summary>
public string? Id { get; }

/// <summary>
/// Initializes a new instance of the <see cref="CategoryIdAttributeBase"/> class.
/// Initializes a new instance of the <see cref="CategoryIdBaseAttribute"/> class.
/// </summary>
/// <param name="category">Category</param>
protected CategoryIdAttributeBase(string category)
protected CategoryIdBaseAttribute(string category)
: base(category) { }

/// <summary>
/// Initializes a new instance of the <see cref="CategoryIdAttributeBase"/> class.
/// Initializes a new instance of the <see cref="CategoryIdBaseAttribute"/> class.
/// </summary>
/// <param name="category">Category</param>
/// <param name="id">Id</param>
protected CategoryIdAttributeBase(string category, string? id)
protected CategoryIdBaseAttribute(string category, string? id)
: base(category) => Id = id;

/// <inheritdoc/>
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.NUnit/IssueAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as Issue, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class IssueAttribute : CategoryIdAttributeBase
public sealed class IssueAttribute : CategoryIdBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="IssueAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.NUnit/UserStoryAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as UserStory, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class UserStoryAttribute : CategoryIdAttributeBase
public sealed class UserStoryAttribute : CategoryIdBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="UserStoryAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.NUnit/WorkItemAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as WorkItem, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class WorkItemAttribute : CategoryIdAttributeBase
public sealed class WorkItemAttribute : CategoryIdBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="WorkItemAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/AcceptanceTestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as <see cref="AcceptanceTestAttribute"/>
/// </summary>
public sealed class AcceptanceTestAttribute : CategoryTraitAttributeBase
public sealed class AcceptanceTestAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="AcceptanceTestAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/BugAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Attribute used to decorate a test class or method as Bug, with optional Id
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class BugAttribute : CategoryWithIdTraitAttributeBase
public sealed class BugAttribute : CategoryWithIdTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="BugAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/EndToEndTestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as EndToEndTest
/// </summary>
public sealed class EndToEndTestAttribute : CategoryTraitAttributeBase
public sealed class EndToEndTestAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="EndToEndTestAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/EpicAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as Epic, with optional Id
/// </summary>
public sealed class EpicAttribute : CategoryWithIdTraitAttributeBase
public sealed class EpicAttribute : CategoryWithIdTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="EpicAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/FeatureAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as Feature, with optional Id
/// </summary>
public sealed class FeatureAttribute : CategoryWithIdTraitAttributeBase
public sealed class FeatureAttribute : CategoryWithIdTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="FeatureAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/FunctionalTestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as IntegrationTest
/// </summary>
public sealed class FunctionalTestAttribute : CategoryTraitAttributeBase
public sealed class FunctionalTestAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="FunctionalTestAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/IntegrationTestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as IntegrationTest
/// </summary>
public sealed class IntegrationTestAttribute : CategoryTraitAttributeBase
public sealed class IntegrationTestAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="IntegrationTestAttribute"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@
Inherited = true
)]
[TraitDiscoverer(Namespaces.CategoryTraitDiscoverer, Namespaces.Assembly)]
[SuppressMessage(
"Naming",
"CA1710:Identifiers should have correct suffix",
Justification = "Conflicting naming convention"
)]
public abstract class CategoryTraitAttributeBase : Attribute, ITraitAttribute
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "As designed.")]
public abstract class CategoryTraitBaseAttribute : Attribute, ITraitAttribute
{
/// <summary>
/// Gets the category value of the trait.
/// </summary>
public string Category { get; }

/// <summary>
/// Initializes a new instance of the <see cref="CategoryTraitAttributeBase"/> class.
/// Initializes a new instance of the <see cref="CategoryTraitBaseAttribute"/> class.
/// </summary>
/// <param name="category"></param>
protected CategoryTraitAttributeBase(string category) => Category = category;
protected CategoryTraitBaseAttribute(string category) => Category = category;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Xunit.Abstractions;

/// <summary>
/// Discoverer for all implementations of <see cref="CategoryTraitAttributeBase"/>.
/// Discoverer for all implementations of <see cref="CategoryTraitBaseAttribute"/>.
/// </summary>
public sealed class CategoryTraitDiscoverer : DiscovererBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
Inherited = true
)]
[TraitDiscoverer(Namespaces.CategoryTraitDiscoverer, Namespaces.Assembly)]
[SuppressMessage(
"Naming",
"CA1710:Identifiers should have correct suffix",
Justification = "Conflicting naming convention"
)]
public abstract class CategoryWithIdTraitAttributeBase : Attribute, ITraitAttribute
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "As designed.")]
public abstract class CategoryWithIdTraitBaseAttribute : Attribute, ITraitAttribute
{
/// <summary>
/// Gets the category value of the trait.
Expand All @@ -45,22 +41,22 @@ public abstract class CategoryWithIdTraitAttributeBase : Attribute, ITraitAttrib
public string? Id { get; }

/// <summary>
/// Initializes a new instance of the <see cref="CategoryWithIdTraitAttributeBase"/> class.
/// Initializes a new instance of the <see cref="CategoryWithIdTraitBaseAttribute"/> class.
/// </summary>
/// <param name="category">Category</param>
/// <param name="id">Id</param>
protected CategoryWithIdTraitAttributeBase(string category, string? id)
protected CategoryWithIdTraitBaseAttribute(string category, string? id)
{
Category = category;
Id = id;
}

/// <summary>
/// Initializes a new instance of the <see cref="CategoryWithIdTraitAttributeBase"/> class.
/// Initializes a new instance of the <see cref="CategoryWithIdTraitBaseAttribute"/> class.
/// </summary>
/// <param name="category">Category</param>
/// <param name="id">Id</param>
protected CategoryWithIdTraitAttributeBase(string category, long id)
protected CategoryWithIdTraitBaseAttribute(string category, long id)
{
Category = category;
Id = $"{id}";
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/IssueAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as Issue, with optional Id
/// </summary>
public sealed class IssueAttribute : CategoryWithIdTraitAttributeBase
public sealed class IssueAttribute : CategoryWithIdTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="IssueAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/PerformanceTestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as PerformanceTest
/// </summary>
public sealed class PerformanceTestAttribute : CategoryTraitAttributeBase
public sealed class PerformanceTestAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PerformanceTestAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/PostDeploymentAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method with TestCategory PostDeployment
/// </summary>
public sealed class PostDeploymentAttribute : CategoryTraitAttributeBase
public sealed class PostDeploymentAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PostDeploymentAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/PreDeploymentAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method with TestCategory PreDeployment
/// </summary>
public sealed class PreDeploymentAttribute : CategoryTraitAttributeBase
public sealed class PreDeploymentAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PreDeploymentAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/UnitTestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as UnitTest
/// </summary>
public sealed class UnitTestAttribute : CategoryTraitAttributeBase
public sealed class UnitTestAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="UnitTestAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/UserStoryAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as UserStory, with optional Id
/// </summary>
public sealed class UserStoryAttribute : CategoryWithIdTraitAttributeBase
public sealed class UserStoryAttribute : CategoryWithIdTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="UserStoryAttribute"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/WorkItemAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// <summary>
/// Attribute used to decorate a test class or method as WorkItem, with optional Id
/// </summary>
public sealed class WorkItemAttribute : CategoryWithIdTraitAttributeBase
public sealed class WorkItemAttribute : CategoryWithIdTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="WorkItemAttribute"/> class.
Expand Down

0 comments on commit fb48320

Please sign in to comment.