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

S4039: Update RSPEC to align with rule implementation #8372

Closed
lg2de opened this issue Nov 16, 2023 · 1 comment · Fixed by SonarSource/rspec#4586
Closed

S4039: Update RSPEC to align with rule implementation #8372

lg2de opened this issue Nov 16, 2023 · 1 comment · Fixed by SonarSource/rspec#4586
Assignees
Labels
Area: C# C# rules related issues. Type: RSPEC Rule description changes

Comments

@lg2de
Copy link
Contributor

lg2de commented Nov 16, 2023

Description

S4039 should not be raised for explicitly implementing internal interfaces.
According to the description, the rule is intended for public interfaces.

Repro steps

internal interface IMyInternalInterface
{
void InternalMethod();
}

public class TheImplementation : IMyInternalInterface
{
void IMyInternalInterface.InternalMethod() // S4039 should not be raised here
{
// foo
}
}

Expected behavior

S4039 should not be raised for explicitly implementing internal interfaces.

Actual behavior

S4039 raised.

Known workarounds

N/A

Related information

  • C#/VB.NET Plugins version: Rider SonarLint plugin 10.0.1.77000
  • Operating System: Windows 11
@sebastien-marichal
Copy link
Contributor

sebastien-marichal commented Nov 28, 2023

Hello @lg2de,

Thank you for pointing this issue to us and sorry for the delay.

I believe this is raised correctly, the rule is about avoiding making members inaccessible during interface implementation.
Whether the interface is internal or public should not make a difference.

However, as you pointed out, the rule description does not match the actual behavior.
The description should not suggest this rule applies only to public interface.

@sebastien-marichal sebastien-marichal changed the title Fix S4039 FP: Should not be raised for internal interfaces S4039: Update RSPEC to align with rule implementation Nov 28, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource added Type: RSPEC Rule description changes and removed Type: Improvement labels Jun 13, 2024
@sebastien-marichal sebastien-marichal self-assigned this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: RSPEC Rule description changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants