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

FN S1128: No issue is raised when the unnecessary using is inside a file scoped namespace #6012

Closed
csaba-sagi-sonarsource opened this issue Aug 17, 2022 · 0 comments · Fixed by #6013
Assignees
Labels
Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@csaba-sagi-sonarsource
Copy link
Contributor

Description

S1128 does not raise an issue for unused usings inside a file scoped namespace.

Repro steps

using System;

namespace MyNamespace0;

using MySysAlias = System;
using System.Linq; // Noncompliant {{Remove this unnecessary 'using'.}}
using System.Collections; // Noncompliant
using System.Globalization; // Noncompliant
using System.Collections.Generic;
using static System.Console;

class C
{
    MySysAlias.StringComparer x;

    void M(IEnumerable<string> myEnumerable)
    {
        WriteLine("");
        MySysAlias.Console.WriteLine("");
    }
}

Expected behavior

An issue should be raised.

Actual behavior

No issues are raised.

Known workarounds

None

Related information

  • C#/VB.NET Plugins version: 8.43.0.51858
@csaba-sagi-sonarsource csaba-sagi-sonarsource added Type: False Negative Rule is NOT triggered when it should be. Area: C#10 labels Aug 17, 2022
@github-actions github-actions bot added this to False Negative in Backlog Aug 17, 2022
@github-actions github-actions bot added this to Review in progress in Best Kanban Aug 17, 2022
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Aug 17, 2022
Backlog automation moved this from False Negative to Done Aug 17, 2022
Best Kanban automation moved this from Review approved to Validate Peach Aug 17, 2022
@csaba-sagi-sonarsource csaba-sagi-sonarsource moved this from Validate Peach to Done in Best Kanban Aug 18, 2022
@csaba-sagi-sonarsource csaba-sagi-sonarsource added this to the 8.44 milestone Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Negative Rule is NOT triggered when it should be.
Projects
Best Kanban
  
Done
Backlog
  
Done
2 participants