Showing 5 of 73 total issues
Function dataTask
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
func dataTask(with request: URLRequest) -> Single<Data> {
return Single.create { (event) -> Disposable in
let task = self.base.dataTask(with: request) { (data, response, error) in
if let error = error {
event(.error(error))
- 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 mapService
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func mapService(element: AEXMLElement) -> MusicProvider? {
guard let idString = element.attributes["Id"],
let id = Int(idString),
let name = element.attributes["Name"],
let secureUriString = element.attributes["SecureUri"],
Function observerGroups
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private func observerGroups() {
allGroups
.asObserver()
.subscribe(onNext: { (groups) in
guard let active = self.activeGroupValue() else {
- 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 too many return
statements within this function. Open
return Disposables.create()
Function nowPlayingAction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
internal func nowPlayingAction(collapse: Bool) {
nowPlayingTopConstraint?.isActive = !collapse
nowPlayingHeightConstraint?.isActive = collapse
view.setNeedsLayout()
UIView.animate(withDuration: 0.4) { [weak self] in
- 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"