Skip to content

Commit

Permalink
Merge pull request #111 from arthurward/feature/resolveAnalysisWarnings
Browse files Browse the repository at this point in the history
Resolve code analysis warnings in source generator attributes.
  • Loading branch information
pierre3 authored Nov 25, 2024
2 parents 7b3d1ed + 30bd5bc commit 3cdacae
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public void RegisterAttributes(IncrementalGeneratorInitializationContext context
context.RegisterPostInitializationOutput(context =>
{
const string source = """
#nullable enable
namespace PlantUmlClassDiagramGenerator.SourceGenerator.Attributes;
[global::System.Flags]
Expand Down Expand Up @@ -47,7 +49,7 @@ internal enum AssociationTypes
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Struct)]
internal class PlantUmlDiagramAttribute : global::System.Attribute
internal sealed class PlantUmlDiagramAttribute : global::System.Attribute
{
public Accessibilities IncludeMemberAccessibilities { get; set; } = Accessibilities.NotSet;
public Accessibilities ExcludeMemberAccessibilities { get; set; } = Accessibilities.NotSet;
Expand All @@ -65,7 +67,7 @@ internal class PlantUmlDiagramAttribute : global::System.Attribute
| global::System.AttributeTargets.Event
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Parameter)]
internal class PlantUmlIgnoreAttribute : global::System.Attribute
internal sealed class PlantUmlIgnoreAttribute : global::System.Attribute
{ }
[global::System.AttributeUsage(
Expand All @@ -79,7 +81,7 @@ internal class PlantUmlIgnoreAttribute : global::System.Attribute
| global::System.AttributeTargets.Event
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Parameter)]
internal class PlantUmlAssociationAttribute(string node) : global::System.Attribute
internal sealed class PlantUmlAssociationAttribute(string node) : global::System.Attribute
{
public string Node { get;} = node;
Expand All @@ -100,7 +102,7 @@ internal class PlantUmlAssociationAttribute(string node) : global::System.Attrib
| global::System.AttributeTargets.Event
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Parameter)]
internal class PlantUmlIgnoreAssociationAttribute : global::System.Attribute
internal sealed class PlantUmlIgnoreAssociationAttribute : global::System.Attribute
{ }
[global::System.AttributeUsage(
Expand All @@ -109,12 +111,12 @@ internal class PlantUmlIgnoreAssociationAttribute : global::System.Attribute
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Struct)]
internal class PlantUmlExtraAssociationTargetsAttribute(params global::System.Type[] types ) : global::System.Attribute
internal sealed class PlantUmlExtraAssociationTargetsAttribute(params global::System.Type[] types ) : global::System.Attribute
{
public global::System.Type[] Types { get; } = types;
}
""";
context.AddSource("Attributes", SourceText.From(source, Encoding.UTF8));
context.AddSource("Attributes.g", SourceText.From(source, Encoding.UTF8));
});
}
}
Expand Down

0 comments on commit 3cdacae

Please sign in to comment.