From 30e14918fd3e00b163edc6a90a50eba77e428cf3 Mon Sep 17 00:00:00 2001
From: "coderabbitai[bot]"
<136622811+coderabbitai[bot]@users.noreply.github.com>
Date: Sun, 24 May 2026 08:53:05 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20CodeRabbit=20Chat:=20Implement?=
=?UTF-8?q?=20requested=20code=20changes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 12 ++++----
...Telemetry.SemanticConventions.Analyzers.md | 8 +++---
.../Program.cs | 28 +++++++++++--------
3 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index ff28d30..8b94148 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ When published, consume it as a development-only analyzer dependency:
+ IncludeAssets="analyzers; buildtransitive" />
```
For local evaluation from this checkout, reference the analyzer project directly from a consumer project:
@@ -40,8 +40,8 @@ The package-level generated catalog is in [`docs/Qyl.OpenTelemetry.SemanticConve
| [`QYL0014`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0014) | Warning | Yes | Hard-coded value matches a semantic-convention value constant marked `[Obsolete]` |
| [`QYL0021`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0021) | Warning | No | Library directly references incubating semantic-convention members |
| [`QYL0030`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0030) | Error | Exact replacements only | Supplemental catalog exact replacement in production telemetry emission |
-| [`QYL0031`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0031) | Warning | Exact replacements only | Supplemental catalog context-sensitive, manual-review, removed/no-replacement, or ambiguous payload migration |
-| [`QYL0032`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0032) | Info | Exact replacements only | Supplemental catalog item appears in test, fixture, compatibility, generated, translator, or catalog context |
+| [`QYL0031`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0031) | Warning | No | Supplemental catalog context-sensitive, manual-review, removed/no-replacement, or ambiguous payload migration |
+| [`QYL0032`](docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md#qyl0032) | Info | No | Supplemental catalog item appears in test, fixture, compatibility, generated, translator, or catalog context |
## Examples
@@ -135,7 +135,7 @@ tests/WeaverRoundTrip/generate.sh
# 4. Confirm the analyzer fires QYL0010 against the regenerated file:
dotnet build Qyl.OpenTelemetry.SemanticConventions.Analyzers.slnx \
-c Release -warnaserror:QYL0010
-dotnet test tests/Qyl.OpenTelemetry.SemanticConventions.Analyzers.Tests/Qyl.OpenTelemetry.SemanticConventions.Analyzers.Tests.csproj \
+dotnet test tests/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.Tests/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.Tests.csproj \
--filter 'FullyQualifiedName~WeaverRoundTrip'
```
@@ -147,7 +147,7 @@ Run the repository gates before changing diagnostics, catalog data, or generated
```bash
dotnet build Qyl.OpenTelemetry.SemanticConventions.Analyzers.slnx -c Release
-dotnet test tests/Qyl.OpenTelemetry.SemanticConventions.Analyzers.Tests/Qyl.OpenTelemetry.SemanticConventions.Analyzers.Tests.csproj
+dotnet test tests/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.Tests/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.Tests.csproj
scripts/generate-docs.sh validate
scripts/generate-docs.sh audit
git diff --check
@@ -155,7 +155,7 @@ git diff --check
## Incubation
-This repository is the incubation home for what may eventually be proposed as an official `OpenTelemetry.SemanticConventions.Analyzers` companion to `opentelemetry-dotnet-contrib`. While here, it ships under the `ANcpLua.*` package ID and Apache-2.0 license.
+This repository is the incubation home for what may eventually be proposed as an official `OpenTelemetry.SemanticConventions.Analyzers` companion to `opentelemetry-dotnet-contrib`. While here, it ships under the `Qyl.*` package ID and Apache-2.0 license.
## License
diff --git a/docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md b/docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md
index 0fd0b20..35935fd 100644
--- a/docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md
+++ b/docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md
@@ -17,8 +17,8 @@ This package analyzes OpenTelemetry semantic-convention usage in C# consumers. T
| QYL0014 | Warning | Deprecated semantic-convention value | Yes | A constant string used as the value of a known semantic-convention telemetry attribute matches a value member that is marked [Obsolete] in the consumer's referenced *Values enum class. |
| QYL0021 | Warning | Incubating semantic-convention member used in a library | No | Members under any *.SemanticConventions.Incubating namespace may rename or change values across minor package releases. Library projects (non-exe, non-test) baking direct references push that volatility onto every downstream consumer. |
| QYL0030 | Error | Obsolete semantic convention has an exact replacement | Exact replacements only | A hard-coded semantic-convention name or value matches the supplemental OpenTelemetry migration catalog and has a one-to-one replacement. This supplements, but does not replace, [Obsolete] metadata from OpenTelemetry.SemanticConventions. |
-| QYL0031 | Warning | Semantic convention migration needs review | Exact replacements only | A hard-coded semantic-convention name or value matches the supplemental OpenTelemetry migration catalog, but the migration is context-sensitive or has no safe automatic replacement. |
-| QYL0032 | Info | Legacy semantic convention appears in compatibility or test code | Exact replacements only | A hard-coded semantic-convention name or value appears in test, fixture, compatibility, translator, generated, or catalog code. Keep it only when the old schema is intentionally modeled. |
+| QYL0031 | Warning | Semantic convention migration needs review | No | A hard-coded semantic-convention name or value matches the supplemental OpenTelemetry migration catalog, but the migration is context-sensitive or has no safe automatic replacement. |
+| QYL0032 | Info | Legacy semantic convention appears in compatibility or test code | No | A hard-coded semantic-convention name or value appears in test, fixture, compatibility, translator, generated, or catalog code. Keep it only when the old schema is intentionally modeled. |
## Rule Reference
@@ -102,7 +102,7 @@ Code fix: Exact replacements only.
A hard-coded semantic-convention name or value matches the supplemental OpenTelemetry migration catalog, but the migration is context-sensitive or has no safe automatic replacement.
-Code fix: Exact replacements only.
+Code fix: No.
### QYL0032
@@ -110,7 +110,7 @@ Code fix: Exact replacements only.
A hard-coded semantic-convention name or value appears in test, fixture, compatibility, translator, generated, or catalog code. Keep it only when the old schema is intentionally modeled.
-Code fix: Exact replacements only.
+Code fix: No.
## Precedence and Suppression
diff --git a/tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator/Program.cs b/tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator/Program.cs
index 6233d8d..7e9221f 100644
--- a/tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator/Program.cs
+++ b/tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator/Program.cs
@@ -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";
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 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 fixableIds) =>
+ id == "QYL0030" ? "Exact replacements only"
+ : id is "QYL0031" or "QYL0032" ? "No"
+ : fixableIds.Contains(id) ? "Yes"
+ : "No";
+
private static string Escape(string value) =>
value.Replace("\r", " ", StringComparison.Ordinal)
.Replace("\n", " ", StringComparison.Ordinal)
- .Replace("|", "\\|", StringComparison.Ordinal);
+
}
file enum Mode { Generate, Check, Audit }