Showing 15 of 33 total issues
Function targetContentOffset
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint,
withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard style.shouldCenterOnCells == true else {
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset, withScrollingVelocity: velocity)
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function bind
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
@discardableResult
public func bind() -> Self {
/* Storing lifecycle for the component in the component descriptor */
let node = ObservationTree.shared.currentNode?.addChild(id: self.id)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function bind
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult
public func bind() -> Self {
/* Storing lifecycle for the component in the component descriptor */
let node = ObservationTree.shared.currentNode?.addChild(id: self.id)
Function targetContentOffset
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint,
withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard style.shouldCenterOnCells == true else {
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset, withScrollingVelocity: velocity)
}
Function describe
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
fileprivate mutating func describe(value : Any, parentValue : Any? = nil) -> Content {
let mirror = Mirror(reflecting: value)
if value is AnyOptionalValue, let optionalValue = mirror.descendant("some") {
return describe(value: optionalValue)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function send
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
func send<T : Encodable>(_ value : T) throws {
guard session.connectedPeers.count > 0 else {
return
}
Function send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func send<T : Encodable>(_ value : T) throws {
guard session.connectedPeers.count > 0 else {
return
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
guard window.isUserInteractionEnabled == true else {
continue
}
Avoid deeply nested control flow statements. Open
if window.isKeyWindow {
topViewController = window.rootViewController
}
Function session
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String,
fromPeer peerID: MCPeerID,
at localURL: URL?,
withError error: Error?) {
Avoid too many return
statements within this function. Open
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset)
Avoid too many return
statements within this function. Open
return .scalar(String(describing: value))
Function main
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static func main() {
willBindRootComponent()
RuntimeStorage.RootComponent = self.init().bind()
didBindRootComponent()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function updateChanges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
fileprivate func updateChanges(oldValues : [T], newValues : [T]) {
guard oldValues.count == newValues.count else {
return
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function dismiss
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public func dismiss(id : UUID? = nil) {
guard presenters.count > 0 else {
return
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"