Commit graph

4 commits

Author SHA1 Message Date
Oliver Schneider
5842463562 Run rustfmt 2017-04-12 11:06:32 +02:00
mcarton
90453fd893
Run rustfmt
Only partially apply suggestions.
2016-06-10 00:08:14 +02:00
Oliver Schneider
3b1df8d381 fallout 2016-02-01 13:01:16 +01:00
Oliver Schneider
902c7d832b fix cc computation in the presence of diverging calls
CFG treats diverging calls as its completely own path out of the function.
While this makes sense, it should also mean that a panic should increase the cyclomatic
complexity. Instead it decreases it.

Minimal example:

```rust
if a {
    b
} else {
    panic!("cake");
}
d
```

creates the following graph

```dot
digraph G {
  "if a" -> "b"
  "if a" -> "panic!(\"cake\")"
  "b" -> c
}
```

which has a CC of 1 (3 - 4 + 2). A CC of 1 means there is one path through the program.
Obviously that is wrong. There are two paths. One returning normally, and one panicking.
2015-12-14 14:29:20 +01:00