Skip to content

Commit b180e01

Browse files
wip
1 parent b2532f2 commit b180e01

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/metrics/wmc.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,20 @@ impl Wmc for JavaCode {
138138
fn compute(space_kind: SpaceKind, cyclomatic: &cyclomatic::Stats, stats: &mut Stats) {
139139
use SpaceKind::*;
140140

141-
if let Unit | Class | Interface | Function = space_kind {
142-
if stats.space_kind == Unknown {
143-
stats.space_kind = space_kind;
141+
match space_kind {
142+
Function => {
143+
if stats.space_kind == Unknown {
144+
stats.space_kind = space_kind;
145+
}
146+
// Saves the cyclomatic complexity of the method
147+
stats.cyclomatic = cyclomatic.cyclomatic_sum();
144148
}
149+
Class | Interface | Unit => {
150+
if stats.space_kind == Unknown {
151+
stats.space_kind = space_kind;
152+
}
145153
}
146-
147-
if space_kind == Function {
148-
// Saves the cyclomatic complexity of the method
149-
stats.cyclomatic = cyclomatic.cyclomatic_sum();
154+
_ => {}
150155
}
151156
}
152157
}

0 commit comments

Comments
 (0)