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

Check the NPath calculation #35

Open
tchule opened this issue Sep 3, 2014 · 5 comments
Open

Check the NPath calculation #35

tchule opened this issue Sep 3, 2014 · 5 comments

Comments

@tchule
Copy link
Contributor

tchule commented Sep 3, 2014

See http://codingswag.ghost.io/cyclomatic-and-npath-complexity-explained/.

We should add some test cases for this calculation.

@jbrooksuk
Copy link
Contributor

NPath is now included already. I'm not sure if it's 100% correct, but it's in. See #28 and #29

@jbrooksuk
Copy link
Contributor

I believe that NPath actually needs to consider ternary statements too, so this will need adding.

@tchule
Copy link
Contributor Author

tchule commented Oct 28, 2014

I still have a doubt about this one, I think we need to multiply the _npathComplexity for each statement of the function (that's the difference with the cyclomatic). We should find some reference or some result to compare on a given test case.

@jbrooksuk jbrooksuk reopened this Oct 28, 2014
@jbrooksuk
Copy link
Contributor

Ok, I've re-opened for now then.

@tchule
Copy link
Contributor Author

tchule commented Feb 10, 2017

See https://modess.io/npath-complexity-cyclomatic-complexity-explained/

What we should do :

  • Consider the number of paths inside a context (use the statementStack)
  • Start at 1 as the default value for the number of paths
  • Add 1 when we encounter an ELSE, ELSEIF, CASE (after the first), ...
  • When going down a nesting level (closing a IF statement for exemple), multiply the number of paths of the current context by the number of paths we just closed.

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

No branches or pull requests

2 participants