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

Add exception to rule S4144 when the function body is small. #366

Merged
merged 6 commits into from Aug 8, 2022

Conversation

francoismora
Copy link
Contributor

@francoismora francoismora commented Aug 4, 2022

Fixes SonarSource/SonarJS#3288

This PR changes the rule to look only at function declaration, method definition and variable declarators:

// Function declarations
function foo() {
}

class Foo {
  // Method definitions
  foo() {
  }
}

// Variable declarators:
const foo = () => {
};

We can expect true positives to be ignored with this:
image

@francoismora francoismora self-assigned this Aug 4, 2022
@francoismora francoismora reopened this Aug 4, 2022
src/rules/no-identical-functions.ts Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Aug 5, 2022

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
0.0% 0.0% Duplication

@saberduck saberduck merged commit 0081ef7 into master Aug 8, 2022
@saberduck saberduck deleted the issue-3288-s4144-exception branch August 8, 2022 14:01
@saberduck saberduck added this to the 0.15.0 milestone Aug 8, 2022
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.

S4144 should ignore functions with few statements or a single expression
2 participants