Commit graph

5 commits

Author SHA1 Message Date
mcarton
cbbc667b1b Dogfood for future MATCH_SAME_ARMS lint 2016-02-12 14:30:26 +01:00
mcarton
70124cf591 Fix case conventions 2016-02-05 21:54:29 +01:00
Manish Goregaokar
1605ef6ed4 Rustup to syntax::errors changes 2016-01-02 16:10:15 +05:30
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
Oliver Schneider
617c820e6b compute cyclomatic complexity (adjusted to not punish Rust's match) 2015-12-03 16:41:55 +01:00