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

Calculate MCC (McCabe Complexity) accordingly #1921

Closed
5 of 6 tasks
schalkms opened this issue Sep 16, 2019 · 3 comments · Fixed by #2090
Closed
5 of 6 tasks

Calculate MCC (McCabe Complexity) accordingly #1921

schalkms opened this issue Sep 16, 2019 · 3 comments · Fixed by #2090
Assignees
Milestone

Comments

@schalkms
Copy link
Member

schalkms commented Sep 16, 2019

Your feature request may already be reported!
Please search in the issues before creating a new one.

Expected Behavior

The cyclomatic complexity should be calculated with reference to the control flow graph of the program.

Current Behavior

Some statements that introduce are new path are still not counted.

Context

  • Refactor cases/ComplexClass.kt!!
  • elvis operator ?:
  • && and || not only in if statements but rather in every binary-expression
  • jumps (break / continue)
  • throw
  • safe call operator ?. (can only be accurately calculated using Java byte code)

reference #1793

@arturbosch arturbosch added this to the 1.2.0 milestone Sep 17, 2019
@arturbosch
Copy link
Member

Thanks for tackling this. I suggest to get all points implemented before shipping this if you are okay with it.

@schalkms
Copy link
Member Author

The refactoring of ComplexClass.kt can be done in a single PR.
The rest is mostly testing effort.

@arturbosch
Copy link
Member

I mean this rule is a breaking change/bug fix/improvement and we should ship it in a new minor version when all 6 bullet points are ready.

@arturbosch arturbosch self-assigned this Nov 16, 2019
arturbosch added a commit that referenced this issue Nov 16, 2019
…n ndepend's implementation of cyclomatic complexity - #1921
arturbosch added a commit that referenced this issue Nov 19, 2019
* Simplify cyclomatic complexity visitor logic - #1921

* Support couting ?:, &&, ||, continue and break expressions - #1921

* Update documentation and increase threshold for ComplexMethod based on ndepend's implementation of cyclomatic complexity - #1921

* Make nesting functions configurable - #1921

* Split ComplexMethod test case to many simpler test cases

* Update detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/ComplexMethod.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Update detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/ComplexMethod.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Update detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/internal/CyclomaticComplexity.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Remove semicolon from split delimiters
smyachenkov pushed a commit to smyachenkov/detekt that referenced this issue Dec 9, 2019
* Simplify cyclomatic complexity visitor logic - detekt#1921

* Support couting ?:, &&, ||, continue and break expressions - detekt#1921

* Update documentation and increase threshold for ComplexMethod based on ndepend's implementation of cyclomatic complexity - detekt#1921

* Make nesting functions configurable - detekt#1921

* Split ComplexMethod test case to many simpler test cases

* Update detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/ComplexMethod.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Update detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/ComplexMethod.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Update detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/internal/CyclomaticComplexity.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Remove semicolon from split delimiters
smyachenkov pushed a commit to smyachenkov/detekt that referenced this issue Dec 9, 2019
* Simplify cyclomatic complexity visitor logic - detekt#1921

* Support couting ?:, &&, ||, continue and break expressions - detekt#1921

* Update documentation and increase threshold for ComplexMethod based on ndepend's implementation of cyclomatic complexity - detekt#1921

* Make nesting functions configurable - detekt#1921

* Split ComplexMethod test case to many simpler test cases

* Update detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/ComplexMethod.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Update detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/complexity/ComplexMethod.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Update detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/internal/CyclomaticComplexity.kt

Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>

* Remove semicolon from split delimiters
@lock lock bot locked as resolved and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants