Skip to content
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

Merged
merged 2 commits into from
May 30, 2024

Conversation

mary-georgiou-sonarsource
Copy link
Contributor

Fixes #9336

Copy link
Contributor

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource left a 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)
Copy link
Contributor

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.

Copy link
Contributor Author

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");
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link

Quality Gate Passed Quality Gate passed for 'Sonar .NET Java Plugin'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@mary-georgiou-sonarsource mary-georgiou-sonarsource changed the title Fix S6966 FP: XmlReader and XmlWriter async methods depend on XmlReaderSettings.Async Property Fix S6966 FP: Don't raise on XmlReader and XmlWriter async methods May 30, 2024
Copy link

@mary-georgiou-sonarsource mary-georgiou-sonarsource changed the title Fix S6966 FP: Don't raise on XmlReader and XmlWriter async methods Fix S6966 FP: Don't raise on XmlReader and XmlWriter methods May 30, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource merged commit bd737fd into master May 30, 2024
26 checks passed
@mary-georgiou-sonarsource mary-georgiou-sonarsource deleted the mary/fix-6966-fp branch May 30, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix S6966 FP: Don't raise on XmlReader and XmlWriter methods
2 participants