Commit Graph

6 Commits

Author SHA1 Message Date
Manish Goregaokar
c9342d0121 fmt clippy 2016-01-04 09:56:12 +05:30
Manish Goregaokar
1605ef6ed4 Rustup to syntax::errors changes 2016-01-02 16:10:15 +05:30
llogiq
c645a9febe adding missing doc comments 2015-12-14 22:16:56 +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
Manish Goregaokar
dc414e6c02 Make panic in CC silencable (partial #478) 2015-12-05 14:23:00 +05:30
Oliver Schneider
617c820e6b compute cyclomatic complexity (adjusted to not punish Rust's match) 2015-12-03 16:41:55 +01:00