Warn when direct package reference is unused#121
Open
stan-sz wants to merge 4 commits intodfederm:mainfrom
Open
Warn when direct package reference is unused#121stan-sz wants to merge 4 commits intodfederm:mainfrom
stan-sz wants to merge 4 commits intodfederm:mainfrom
Conversation
3c539ed to
05faa75
Compare
Code up the new rule
dfederm
requested changes
Feb 26, 2026
|
|
||
| _compileTimeAssemblies ??= new(compileTimeAssemblies.Count); | ||
| _compileTimeAssemblies.AddRange(compileTimeAssemblies); | ||
| _compileTimeAssemblies.AddRange(compileTimeAssemblies.Select(assemblyPath => Tuple.Create(packageName, assemblyPath))); |
Owner
There was a problem hiding this comment.
Avoid the allocation. A value tuple would be best.
| "RT0003", | ||
| "Unnecessary package reference", | ||
| "PackageReference {0} can be removed", | ||
| "PackageReference {0} can be removed{1}", |
Owner
There was a problem hiding this comment.
Is this the whole point of the change, to have a slightly different error message?
Its also unclear on how this relates to #119
dfederm
reviewed
Feb 26, 2026
| namespace ReferenceTrimmer.Shared; | ||
|
|
||
| internal readonly record struct DeclaredReference(string AssemblyPath, DeclaredReferenceKind Kind, string Spec); | ||
| internal readonly record struct DeclaredReference(string AssemblyPath, DeclaredReferenceKind Kind, string Spec, string AdditionalSpec); |
Owner
There was a problem hiding this comment.
What's "additional spec"? There's only one "spec" (Include value)
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.
Repro for #119