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

Generic/CyclomaticComplexity: improve error message #743

Open
2 tasks done
rodrigoprimo opened this issue Nov 27, 2024 · 2 comments
Open
2 tasks done

Generic/CyclomaticComplexity: improve error message #743

rodrigoprimo opened this issue Nov 27, 2024 · 2 comments

Comments

@rodrigoprimo
Copy link
Contributor

Is your feature request related to a problem?

Both the warning and the error message displayed by the Generic.Metrics.CyclomaticComplexity sniff could be improved if they included the name of the function that caused the error.

Describe the solution you'd like

Currently, the sniff displays the following error messages:

  72 | WARNING | Function's cyclomatic complexity (20) exceeds 10; consider refactoring the function
 118 | ERROR   | Function's cyclomatic complexity (21) exceeds allowed maximum of 20

I'm suggesting we update them to something like (note that I also added "the" before "allowed maximum"):

  72 | WARNING | Function complexityTwenty()'s cyclomatic complexity (20) exceeds 10; consider refactoring the function
 118 | ERROR   | Function complexityTwentyOne()'s cyclomatic complexity (21) exceeds allowed maximum of 20

Additional context (optional)

Below there are links to the places where the two messages are defined:

$error = 'Function\'s cyclomatic complexity (%s) exceeds allowed maximum of %s';

$warning = 'Function\'s cyclomatic complexity (%s) exceeds %s; consider refactoring the function';

@jrfnl
Copy link
Member

jrfnl commented Nov 27, 2024

Valid suggestion. Low priority.

@jrfnl
Copy link
Member

jrfnl commented Nov 27, 2024

Note: this would become more complex if #742 gets implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants