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 S1144 FN: Unused local functions #6699

Closed
zsolt-kolbay-sonarsource opened this issue Feb 1, 2023 · 1 comment · Fixed by #9071
Closed

Fix S1144 FN: Unused local functions #6699

zsolt-kolbay-sonarsource opened this issue Feb 1, 2023 · 1 comment · Fixed by #9071
Assignees
Labels
Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Negative Rule is NOT triggered when it should be.
Projects
Milestone

Comments

@zsolt-kolbay-sonarsource
Copy link
Contributor

zsolt-kolbay-sonarsource commented Feb 1, 2023

Description

S1144 highlights unused private methods, but unused local methods are not accounted for when this check is performed.

Repro steps

public class MyClass
{
        public void MethodUsingLocalMethod()
        {
            void LocalMethod() // FN: local function is never used
            {

            }
        }
}

Expected behavior

An issue should be raised for this local function.

Actual behavior

No issue is raised.

Known workarounds

None.

Related information

  • C#/VB.NET Plugins version: 8.52
  • Visual Studio version: 2022 17.4.4
  • Operating System: Windows 10 Pro (10.0.19045)
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added Type: False Negative Rule is NOT triggered when it should be. Area: C# C# rules related issues. labels Feb 1, 2023
@andrei-epure-sonarsource
Copy link
Contributor

Related note: GetIdentifier would need to be improved to support Local Functions, something like

{ } localFunction when LocalFunctionStatementSyntaxWrapper.IsInstance(localFunction) => ((LocalFunctionStatementSyntaxWrapper)localFunction).Identifier,

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource removed their assignment Mar 8, 2023
@Tim-Pohlmann Tim-Pohlmann added this to the 9.24 milestone Apr 8, 2024
@Tim-Pohlmann Tim-Pohlmann added the Sprint: Hardening Fix FPs/FNs/improvements label Apr 8, 2024
@Tim-Pohlmann Tim-Pohlmann added this to To do in Best Kanban Apr 8, 2024
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource moved this from To do to In progress in Best Kanban Apr 11, 2024
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Apr 11, 2024
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Apr 11, 2024
Best Kanban automation moved this from Review approved to Validate Peach Apr 11, 2024
@CristianAmbrosini CristianAmbrosini moved this from Validate Peach to Done in Best Kanban Apr 18, 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. Sprint: Hardening Fix FPs/FNs/improvements Type: False Negative Rule is NOT triggered when it should be.
Projects
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants