Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.
Merged
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
10 changes: 5 additions & 5 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 Down Expand Up @@ -64,7 +64,7 @@ activity.SetTag("error.message", message); // QYL0031; replacem
- **Multi-hop rename resolution.** `SemconvMigrationCatalog.ResolveTerminalReplacement` chases `ExactRename` chains (e.g. `http.host` → `net.host.name` → `server.address`) so code-fixes land consumers on the terminal symbol, not on a still-deprecated mid-state. Cycles and chains over 8 hops bail at the last safe step.
- **Structured changelog provenance.** Every `SemconvMigrationCatalogEntry` may carry an optional `SemconvChangelogEvidence` (commit / version / url / quote) pinning the migration claim to an exact upstream commit, so the catalog is auditable without re-parsing CHANGELOG.md.
- **Catalog seeding from upstream.** `scripts/seed-catalog.sh <from-tag> <to-tag>` clones a shallow upstream `open-telemetry/semantic-conventions` checkout, slices CHANGELOG.md between two version tags, and emits C# (or `--format json`) skeleton entries with provenance pre-filled. Curate the `Kind`/`Domain`/`Signal`/`MigrationKind` fields by hand before merging.
- **Generated docs and audit.** Regenerate the package catalog with `scripts/generate-docs.sh generate`; validate with `scripts/generate-docs.sh validate`; print the current 156-entry coverage audit with `scripts/generate-docs.sh audit`. Every `QYL*` rule has a stable `#qyl0010` anchor in the generated docs that every `DiagnosticDescriptor.HelpLinkUri` resolves to.
- **Generated docs and audit.** Regenerate the package catalog with `scripts/generate-docs.sh generate`; validate with `scripts/generate-docs.sh validate`; print the current coverage audit with `scripts/generate-docs.sh audit`. Every `QYL*` rule has a stable `#qyl0010` anchor in the generated docs that every `DiagnosticDescriptor.HelpLinkUri` resolves to.
- **netstandard2.0** only — required by Roslyn analyzer host. Microsoft.CodeAnalysis.* dependencies only.
- **Multi-version friendly.** A consumer on SemConv 1.39.0 gets live metadata diagnostics scoped to the 1.39.0 surface; upgrading expands those diagnostics automatically. The supplemental catalog is a conservative v1.41.0 migration aid.

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 \
Comment thread
ANcpLua marked this conversation as resolved.
--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
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
6 changes: 3 additions & 3 deletions docs/Qyl.OpenTelemetry.SemanticConventions.Analyzers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Qyl.OpenTelemetry.SemanticConventions.Analyzers

<!-- <auto-generated /> This file is generated by tools/Qyl.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator. -->
<!-- <auto-generated /> This file is generated by tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator. -->

This package analyzes OpenTelemetry semantic-convention usage in C# consumers. The consumer's referenced `OpenTelemetry.SemanticConventions` assembly remains the primary source of truth: rules that read `[Obsolete]` metadata report what that package actually generated. The curated inventory below separates live-metadata coverage from supplemental diagnostics for changelog/model entries that are not reliably visible through live metadata.

Expand Down Expand Up @@ -458,8 +458,8 @@ These value rows are intentionally separate from the 156-entry name/key/event/me
Regenerate with:

```bash
dotnet run -c Release --project tools/Qyl.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator
dotnet run -c Release --project tools/Qyl.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator -- --check
dotnet run -c Release --project tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator
dotnet run -c Release --project tools/ANcpLua.OpenTelemetry.SemanticConventions.Analyzers.DocsGenerator -- --check
```

The `--check` mode fails if the generated markdown differs from the checked-in file.
Original file line number Diff line number Diff line change
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,14 +152,26 @@ 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}");
sb.AppendLine($"Code fix: {GetCodeFixLabel(d.Id, fixableIds)}.");
sb.AppendLine();
}
}

private static string GetCodeFixLabel(string diagnosticId, HashSet<string> fixableIds)
{
if (!fixableIds.Contains(diagnosticId))
{
return "No";
}

// QYL0030/QYL0031/QYL0032 share SupplementalSemconvMigrationCodeFixProvider,
// which gates registration via IsExactReplacement (MigrationKind == ExactRename
// / ExactValueRename) per-diagnostic, not by ID. Reflect that contract in docs.
return diagnosticId is "QYL0030" or "QYL0031" or "QYL0032"
? "Exact replacements only"
: "Yes";
}
Comment thread
ANcpLua marked this conversation as resolved.

private static void WritePrecedenceAndSuppression(StringBuilder sb)
Comment thread
ANcpLua marked this conversation as resolved.
{
sb.AppendLine("## Precedence and Suppression");
Expand Down