fix(LC0091): align obsolete handling with compiler XLIFF generation - #563
Merged
Merged
Conversation
…cking Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ymbols The helper comment described only the Removed case while IsRemoved() also returns true for Moved, which mirrors ShouldSymbolBeVisited skipping a Moved table or field. The rule doc now lists Moved fields among the deliberate non-reports. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
LC0091 reads source symbols, computes each trans-unit id and looks it up in the translated
.xlffiles, so it has to replicate the compiler's decision of which units are locked or dropped. It gated every callback on the generalIsObsolete()check (Pending, Removed, Moved, PendingMove, on the symbol and its containing object) and additionally dropped labels and report labels whenever their containing object was obsolete. The compiler is narrower, which left false negatives: Pending captions and tooltips, and labels left behind in obsolete objects, were never reported although the XLIFF still carries their units.Compiler behaviour (nav-sdk-source, identical from SDK 12 to 30)
Translation/LabelWriterVisitor.cs:IsObsoletelocks a field when it or its containing table isIsObsoleteRemoved, and any other symbol only when it isIsObsoleteRemoveditself.IsObsoletePendingis never read.FieldSymbol,KeySymbol,TableTypeSymbol,TableExtensionTypeSymbol(forwarding to its target) andRecordTypeSymboloverrideIsObsoleteRemoved; pages, controls, actions, enums, reports and the other object kinds can never be Removed.ShouldSymbolBeVisitedskips a Moved table or field and its whole subtree.PendingMoveis neither skipped nor locked.VisitVariableandVisitReportLabelpass no lock flag; a label is locked only by its ownLocked = true.XliffOutputter.WriteLabeldrops locked units (or writestranslate="no"underGenerateLockedTranslations).Change
Locked = trueTranslatableTextShouldBeTranslated: theIsObsolete()gate becomes a Moved-container check; property lock decisions go throughIsLockedByCompiler, a mirror of the visitor'sIsObsoletebuilt on the existingIsRemoved(); the containing-object check on report labels is gone; controls, actions and analysis views useIsRemoved().ALCops.Common:IsMoved()next toIsRemoved(), reusing the existing reflection accessor.HasDiagnosticcases (all failing before the change) and fourNoDiagnosticregression guards for the Removed paths..claudedocs: rule doc design decision, non-reports, SDK facts and test notes; compiler-parity exception on theIsObsolete()-first rule inanalyzer-development.mdandREVIEW.md.Verification
dotnet test ALCops.sln1895 passed.dotnet format --verify-no-changesclean; Common and all six cops build fornetstandard2.1;net8.0;net10.0with 0 warnings.Validate-Rules.ps1passes./code-reviewat effort high: one finding on the helper comment, addressed in the last commit.Companion docs PR: ALCops/alcops.dev#191
Closes #385
🤖 Generated with Claude Code