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

S1144: Add repro for #8342 #8354

Merged
merged 2 commits into from
Nov 16, 2023
Merged

S1144: Add repro for #8342 #8354

merged 2 commits into from
Nov 16, 2023

Conversation

antonioaversa
Copy link
Contributor

Reproduces #8342

namespace Tests.Diagnostics
using System;

namespace Tests.Diagnostics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised you haven't fought your war against block-scoped namespaces for this file 😄
Edit: nevermind, I saw that it namespaces have some actual purpose here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in this case there are other namespaces, so I could not easily go for it :-)

// https://github.com/SonarSource/sonar-dotnet/issues/8342
class Repro_8342
{
[Private1] public void APublicMethod() => APrivateMethodCalledByAPublicMethod();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's also worth adding a test case with multiple attributes (and list attributes):

[SomePublicAttribute, Private1]
public void Something() { }

[SomePublicAttribute]
[Private1]
public void Something2() { }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, please check out my suggestion before merging!

@antonioaversa antonioaversa force-pushed the antonio/S1144-repro-8342 branch from d0e6954 to 36de33b Compare November 15, 2023 16:49
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@antonioaversa antonioaversa merged commit c746b74 into master Nov 16, 2023
24 checks passed
@antonioaversa antonioaversa deleted the antonio/S1144-repro-8342 branch November 16, 2023 09:15
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.

2 participants