Commit graph

10 commits

Author SHA1 Message Date
Oliver Schneider
a56af73fd8
mark cyclomatic complexity attribute as used
fixes #1315
2016-11-02 10:29:57 +01:00
Oliver 'ker' Schneider
bf4221c51a cc: early returns are special 2016-04-23 14:30:05 +02:00
mcarton
831b8fc1b5 Ignore #[test] fns in cyclomatic_complexity 2016-04-14 17:26:07 +02:00
Oliver Schneider
d5a01e8789 prevent cc lint from panicking on unreachable code 2016-03-14 17:24:55 +01:00
Oliver Schneider
bf20b40664 fix cyclomatic complexity lint triggering because of short circuit operations 2016-03-08 15:10:02 +01:00
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