-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
Property inside struct, class or enum (computed property) is ignored by complexityCalculator.
example:
struct S {
var v: String {
let rand = Int.random(in: 0..<10)
// return rand == 0 || rand > 5
if rand == 0 {
return true
}
if rand > 5 {
return true
} else {
return false
}
}
}Steps to Reproduce
- Run example code on debug site.
- Conform that result is empty.
Expected Behavior
Computed property should be also processed. (cyclomatic: 3, cognitive: 3)
Actual Behavior
Process is skipped.
Swift Code Sample
struct S {
var v: String {
let rand = Int.random(in: 0..<10)
// return rand == 0 || rand > 5
if rand == 0 {
return true
}
if rand > 5 {
return true
} else {
return false
}
}
}Command Used
Output/Error Messages
Platform
Linux (Ubuntu)
OS Version
jammy
Swift Version
6.1
swift-complexity Version
0.0.5
Pre-submission Checks
- I have searched existing issues to ensure this is not a duplicate
- I have tested with the latest version of swift-complexity
- I have provided all the required information above
Additional Context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working