-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix S6966 FP: Don't raise on XmlReader and XmlWriter methods #9364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Left a couple of polishing comments.
@@ -104,6 +105,10 @@ private static WellKnownExtensionMethodContainer BuildWellKnownExtensionMethodCo | |||
{ | |||
exclusions.Add(x => x.Is(KnownType.MongoDB_Driver_IMongoCollectionExtensions, "Find")); // https://github.com/SonarSource/sonar-dotnet/issues/9265 | |||
} | |||
if (compilation.GetTypeByMetadataName(KnownType.System_Xml_XmlReader) is not null || compilation.GetTypeByMetadataName(KnownType.System_Xml_XmlWriter) is not null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. Those types are always available and we filter for types rather than methods for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I forgot this there - I was trying to add the exclusions in this method as it made more sense - but did not work out. :/
@@ -629,6 +629,7 @@ public sealed partial class KnownType | |||
public static readonly KnownType System_Xml_XmlUrlResolver = new("System.Xml.XmlUrlResolver"); | |||
public static readonly KnownType System_Xml_XmlTextReader = new("System.Xml.XmlTextReader"); | |||
public static readonly KnownType System_Xml_Resolvers_XmlPreloadedResolver = new("System.Xml.Resolvers.XmlPreloadedResolver"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CAYC: please move this up so they are sorted alphabetically.
builder | ||
.AddReferences(MetadataReferenceFacade.SystemXml) | ||
.AddSnippet(""" | ||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This using isn't needed.
Quality Gate passed for 'Sonar .NET Java Plugin'Issues Measures |
Quality Gate passed for 'SonarAnalyzer for .NET'Issues Measures |
Fixes #9336