Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ When published, consume it as a development-only analyzer dependency:
<PackageReference Include="Qyl.OpenTelemetry.SemanticConventions.Analyzers"
Version="..."
PrivateAssets="all"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
IncludeAssets="analyzers; buildtransitive" />
```

For local evaluation from this checkout, reference the analyzer project directly from a consumer project:
Expand All @@ -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

Expand Down Expand Up @@ -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'
```

Expand All @@ -147,15 +147,15 @@ 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
Comment on lines 138 to +150
Copy link
Copy Markdown

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 ANcpLua prefix. Given the package is being renamed to Qyl (as confirmed on line 158), this path should likely remain Qyl to match the new naming convention.

Suggested change
dotnet test tests/Qyl.OpenTelemetry.SemanticConventions.Analyzers.Tests/Qyl.OpenTelemetry.SemanticConventions.Analyzers.Tests.csproj

scripts/generate-docs.sh validate
scripts/generate-docs.sh audit
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

Expand Down
8 changes: 4 additions & 4 deletions docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -102,15 +102,15 @@ 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

**Legacy semantic convention appears in compatibility or test code** — *Info, category `OpenTelemetry.SemanticConventions`*

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

The ProjectRelativePath is constructed using PackageName ('Qyl...'), but the actual directory on disk still uses the 'ANcpLua' prefix. This mismatch will break documentation regeneration commands unless the directory itself is renamed.


public static int Run(string[] args)
{
Expand Down Expand Up @@ -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())} |");
}
}
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark QYL0031/QYL0032 as conditionally fixable

GetCodeFixLabel now hard-codes QYL0031/QYL0032 to "No", but the code-fix provider still advertises those IDs and registers a replacement when MigrationKind is ExactRename/ExactValueRename (for example when QYL0032 is reported in compatibility/test context for an exact rename). This causes generated docs/README to incorrectly claim no fix is available in cases where a fix is actually offered.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
.Replace("|", "\\|", StringComparison.Ordinal);

Comment on lines 437 to +440
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore Escape method terminator and pipe escaping

The Escape helper is now syntactically incomplete: the expression-bodied method ends at .Replace("\n", " ", StringComparison.Ordinal) without a terminating ; (and the prior | escaping call was dropped), so tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator will not compile when running the docs generator/check workflow. This breaks repository gates that invoke the generator and should be fixed before merging.

Useful? React with 👍 / 👎.

}

file enum Mode { Generate, Check, Audit }
Expand Down
Loading