Skip to content

Commit

Permalink
Remove CodeFixOptionAttribute (#1414)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Feb 26, 2024
1 parent 823d74b commit a687d57
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static async Task<Document> RefactorAsync(

if (document.TryGetAnalyzerOptionValue(
memberDeclaration,
CodeFixOptions.CS1591_MissingXmlCommentForPubliclyVisibleTypeOrMember_IgnoredTags,
CodeFixOptions.CS1591_MissingXmlCommentForPubliclyVisibleTypeOrMember_IgnoredTags.Key,
out string value))
{
ImmutableArray<string> ignoredTags = value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) .NET Foundation and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Roslynator.Metadata;
namespace Roslynator;

public readonly record struct CodeFixOption(string Key, string Value);
16 changes: 0 additions & 16 deletions src/CodeFixes/CodeFixOptionAttribute.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/CodeFixes/CodeFixOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ namespace Roslynator;

internal static class CodeFixOptions
{
[CodeFixOption("<COMMA_SEPARATED_LIST_OF_IGNORED_XML_TAGS>")]
public const string CS1591_MissingXmlCommentForPubliclyVisibleTypeOrMember_IgnoredTags = "roslynator.CS1591.ignored_tags";
public static readonly CodeFixOption CS1591_MissingXmlCommentForPubliclyVisibleTypeOrMember_IgnoredTags = new("roslynator.CS1591.ignored_tags", "<COMMA_SEPARATED_LIST_OF_IGNORED_XML_TAGS>");
}
2 changes: 1 addition & 1 deletion src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ IEnumerable<MTableRow> GetRows()
public static string CreateCodeFixMarkdown(
CompilerDiagnosticMetadata diagnostic,
IEnumerable<CodeFixMetadata> codeFixes,
ImmutableArray<CodeFixOption> options,
IEnumerable<CodeFixOption> options,
IComparer<string> comparer)
{
MDocument document = Document(
Expand Down
12 changes: 3 additions & 9 deletions src/Tools/MetadataGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,9 @@ private static void GenerateCodeFixesMarkdown(RoslynatorMetadata metadata, strin
MarkdownGenerator.CreateCodeFixesMarkdown(diagnostics, StringComparer.InvariantCulture),
sidebarLabel: "Code Fixes for Compiler Diagnostics");

ImmutableArray<CodeFixOption> codeFixOptions = typeof(CodeFixOptions).GetFields()
.Select(f =>
{
var key = (string)f.GetValue(null);
string value = f.GetCustomAttribute<CodeFixOptionAttribute>().Value;
return new CodeFixOption(key, value);
})
.ToImmutableArray();
List<CodeFixOption> codeFixOptions = typeof(CodeFixOptions).GetFields()
.Select(f => (CodeFixOption)f.GetValue(null))
.ToList();

string fixesDirPath = Path.Combine(destinationPath, "fixes");
Directory.CreateDirectory(fixesDirPath);
Expand Down

0 comments on commit a687d57

Please sign in to comment.