-
Notifications
You must be signed in to change notification settings - Fork 0
📝 CodeRabbit Chat: Implement requested code changes #23
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |||||
| file static class DocsGenerator | ||||||
| { | ||||||
| private const string PackageName = "Qyl.OpenTelemetry.SemanticConventions.Analyzers"; | ||||||
| private const string ProjectRelativePath = "tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator"; | ||||||
| private const string ProjectRelativePath = "tools/" + PackageName + ".DocsGenerator"; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK The |
||||||
|
|
||||||
| public static int Run(string[] args) | ||||||
| { | ||||||
|
|
@@ -126,9 +126,7 @@ private static void WriteDiagnostics( | |||||
| sb.AppendLine("| -- | -- | -- | -- | -- |"); | ||||||
| foreach (var d in descriptors) | ||||||
| { | ||||||
| var codeFix = fixableIds.Contains(d.Id) | ||||||
| ? d.Id == "QYL0030" ? "Exact replacements only" : "Yes" | ||||||
| : "No"; | ||||||
| var codeFix = GetCodeFixLabel(d.Id, fixableIds); | ||||||
| sb.AppendLine($"| {d.Id} | {d.DefaultSeverity} | {Escape(d.Title.ToString())} | {codeFix} | {Escape(d.Description.ToString())} |"); | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -154,10 +152,8 @@ private static void WriteDiagnosticAnchors( | |||||
| sb.AppendLine(); | ||||||
| sb.AppendLine(Escape(d.Description.ToString())); | ||||||
| sb.AppendLine(); | ||||||
| var codeFix = fixableIds.Contains(d.Id) | ||||||
| ? d.Id == "QYL0030" ? "Exact replacements only." : "Yes." | ||||||
| : "No."; | ||||||
| sb.AppendLine($"Code fix: {codeFix}"); | ||||||
| var codeFix = GetCodeFixLabel(d.Id, fixableIds); | ||||||
| sb.AppendLine($"Code fix: {codeFix}."); | ||||||
| sb.AppendLine(); | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -351,8 +347,8 @@ private static void WriteGeneratedFile(StringBuilder sb) | |||||
| sb.AppendLine("Regenerate with:"); | ||||||
| sb.AppendLine(); | ||||||
| sb.AppendLine("```bash"); | ||||||
| sb.AppendLine($"dotnet run -c Release --project tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator"); | ||||||
| sb.AppendLine($"dotnet run -c Release --project tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator -- --check"); | ||||||
| sb.AppendLine($"dotnet run -c Release --project {ProjectRelativePath}"); | ||||||
| sb.AppendLine($"dotnet run -c Release --project {ProjectRelativePath} -- --check"); | ||||||
| sb.AppendLine("```"); | ||||||
| sb.AppendLine(); | ||||||
| sb.AppendLine("The `--check` mode fails if the generated markdown differs from the checked-in file."); | ||||||
|
|
@@ -428,10 +424,20 @@ private static string FormatReplacement(ImmutableArray<string> names) => | |||||
| ? "-" | ||||||
| : Escape(string.Join(", ", names.Select(n => "`" + n + "`"))); | ||||||
|
|
||||||
| // QYL0030 has a code fix for exact one-to-one replacements only. | ||||||
| // QYL0031 and QYL0032 are registered in FixableDiagnosticIds for the | ||||||
| // supplemental provider, but only activate when the catalog entry is an | ||||||
| // ExactRename — they are not user-visible as general automatic code fixes. | ||||||
| private static string GetCodeFixLabel(string id, HashSet<string> fixableIds) => | ||||||
| id == "QYL0030" ? "Exact replacements only" | ||||||
| : id is "QYL0031" or "QYL0032" ? "No" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||||||
| : fixableIds.Contains(id) ? "Yes" | ||||||
| : "No"; | ||||||
|
|
||||||
| private static string Escape(string value) => | ||||||
| value.Replace("\r", " ", StringComparison.Ordinal) | ||||||
| .Replace("\n", " ", StringComparison.Ordinal) | ||||||
| .Replace("|", "\\|", StringComparison.Ordinal); | ||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK This change results in a syntax error due to the missing semicolon at the end of the method expression. Additionally, it removes the pipe character escaping which is required for valid Markdown table generation when descriptors contain the '|' character.
Suggested change
Comment on lines
437
to
+440
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Useful? React with 👍 / 👎. |
||||||
| } | ||||||
|
|
||||||
| file enum Mode { Generate, Check, Audit } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 HIGH RISK
This project path is being reverted to the old
ANcpLuaprefix. Given the package is being renamed toQyl(as confirmed on line 158), this path should likely remainQylto match the new naming convention.