JohnCoates/Aerial

View on GitHub
Aerial/Source/Models/Prefs/PrefsInfo.swift

Summary

Maintainability
F
5 days
Test Coverage

File PrefsInfo.swift has 588 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation
import ScreenSaver

protocol CommonInfo {
    var isEnabled: Bool { get set }
Severity: Major
Found in Aerial/Source/Models/Prefs/PrefsInfo.swift - About 1 day to fix

    Function updateLayerList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        static func updateLayerList() {
            if !PrefsInfo.layers.contains(.battery) {
                PrefsInfo.layers.append(.battery)
            }
    
    
    Severity: Minor
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift - About 35 mins to fix

    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

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        static func setDisplayMode(_ type: InfoType, mode: InfoDisplays) {
            switch type {
            case .location:
                location.displays = mode
            case .message:
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 4 other locations - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 424..447
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 449..472
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 474..497
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 499..523

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        static func setCorner(_ type: InfoType, corner: InfoCorner) {
            switch type {
            case .location:
                location.corner = corner
            case .message:
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 4 other locations - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 424..447
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 449..472
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 474..497
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 524..547

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        static func setFontSize(_ type: InfoType, size: Double) {
            switch type {
            case .location:
                location.fontSize = size
            case .message:
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 4 other locations - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 424..447
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 449..472
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 499..523
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 524..547

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        static func setEnabled(_ type: InfoType, value: Bool) {
            switch type {
            case .location:
                location.isEnabled = value
            case .message:
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 4 other locations - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 449..472
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 474..497
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 499..523
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 524..547

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        static func setFontName(_ type: InfoType, name: String) {
            switch type {
            case .location:
                location.fontName = name
            case .message:
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 4 other locations - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 424..447
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 474..497
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 499..523
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 524..547

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if #available(OSX 10.15, *) {
                    if let userDefaults = UserDefaults(suiteName: bundleID) {
                        // We shoot for a string in the new system
                        if let jsonString = userDefaults.string(forKey: key) {
                            guard let jsonData = jsonString.data(using: .utf8) else {
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 618..639

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 154.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                } else {
                    if let userDefaults = ScreenSaverDefaults(forModuleWithName: module) {
                        // We shoot for a string in the new system
                        if let jsonString = userDefaults.string(forKey: key) {
                            guard let jsonData = jsonString.data(using: .utf8) else {
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 2 hrs to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 597..618

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 154.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        struct Countdown: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 2 other locations - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 93..104
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 175..186

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        struct Timer: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 2 other locations - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 93..104
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 162..173

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        struct Message: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 2 other locations - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 162..173
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 175..186

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        struct IDate: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 143..151

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 88.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        struct Battery: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 117..125

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 88.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        struct Location: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 153..160

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        struct Updates: CommonInfo, Codable {
            var isEnabled: Bool
            var fontName: String
            var fontSize: Double
            var corner: InfoCorner
    Severity: Major
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 1 hr to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 84..91

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                } else {
                    if let userDefaults = ScreenSaverDefaults(forModuleWithName: module) {
                        // Set value to UserDefaults
                        userDefaults.set(jsonString, forKey: key)
    
    
    Severity: Minor
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 35 mins to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 654..666

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if #available(OSX 10.15, *) {
                    if let userDefaults = UserDefaults(suiteName: bundleID) {
                        // Set value to UserDefaults
                        userDefaults.set(jsonString, forKey: key)
    
    
    Severity: Minor
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 35 mins to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 666..678

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                } else {
                    if let userDefaults = ScreenSaverDefaults(forModuleWithName: module) {
                        return userDefaults.object(forKey: key) as? T ?? defaultValue
                    }
                }
    Severity: Minor
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 30 mins to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 697..701

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if #available(OSX 10.15, *) {
                    if let userDefaults = UserDefaults(suiteName: bundleID) {
                        return userDefaults.object(forKey: key) as? T ?? defaultValue
                    }
                } else {
    Severity: Minor
    Found in Aerial/Source/Models/Prefs/PrefsInfo.swift and 1 other location - About 30 mins to fix
    Aerial/Source/Models/Prefs/PrefsInfo.swift on lines 701..705

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status