Skip to content

Conversation

Corniel
Copy link
Contributor

@Corniel Corniel commented Jul 2, 2025

In the past I've put in some effort to implement existing rules for VB.NET too. I'm not sure if you still put any effort in doing that, but while cleaning up me repo, I thought I might be nice to share it.

All rules under the (arbitrary) size of 2kb are:

ID Rule Size
S1116 EmptyStatement 1.4kb
S1848 ObjectCreatedDropped 1.7kb
S1264 UseWhileLoopInstead 1.7kb
S1199 NestedCodeBlock 1.7kb
S4016 EnumsShouldNotBeNamedReserved 1.8kb
S3261 EmptyNamespace 1.8kb
S3880 FinalizerShouldNotBeEmpty 1.8kb
S6377 XmlSignatureCheck 1.9kb
S3244 AnonymousDelegateEventUnsubscribe 1.9kb

@alex-meseldzija-sonarsource
Copy link
Contributor

Hi @Corniel,
Thanks for the suggestions!

We do still put effort into porting rules, we recently ported S6418 to VB.NET.

I discussed with the team and had a look at the data of the rules suggested:

In order of Cool and Valuable (i.e. hit a lot of projects and are useful in C#):

  • S6377 - In general, hotspots dependant on trackers should be easy to abstract to a base class, even when it results in more code
  • S3261 - would be nice
  • S3244 - relevant

Limited Value

  • S3880 - relevant, but the implementation would be different to the point it would no longer be an easy win.
  • S4016 - non SonarWay & deprecated

Unfortunately don't apply to VB:

I've created:

NET-2149 New Rule: Implement S6377 XML signatures should be validated securely for VB.NET
NET-2150 New Rule: Implement S3261 Namespaces should not be empty for VB.NET
NET-2151 New Rule: Implement S3244 Anonymous delegates should not be used to unsubscribe from events for VB.NET

I can't guarantee if/when we will get to them, but we are tracking them :)

@Corniel
Copy link
Contributor Author

Corniel commented Jul 7, 2025

I'm personally not using VB.NET anymore (in my previous company I did). But I ported some of them in the past, and this query helped me detect some low hanging fruit. Hence the idea to share it.

And as you mentioned, some of them indeed are C# specific. I'll update the request to filter those out.

@Tim-Pohlmann
Copy link
Contributor

I'm closing this, since the code shared is only for demonstrating purposes and tickets to follow-up on the data have been created.
Thanks a lot for sharing @Corniel!

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.

3 participants