hackedteam/core-ios

View on GitHub
ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift

Summary

Maintainability
F
5 days
Test Coverage

File KeyboardLayout.swift has 509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import UIKit

// TODO: need to rename, consolidate, and define terms
class LayoutConstants: NSObject {
    class var landscapeRatio: CGFloat { get { return 2 }}
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 1 day to fix

    Function layoutKeys has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        func layoutKeys(model: Keyboard, views: [Key:KeyboardKey], bounds: CGRect) {
            if bounds.height == 0 || bounds.width == 0 {
                return
            }
            
    Severity: Minor
    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 5 hrs 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

    Function createViews has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        func createViews(keyboard: Keyboard) {
            let specialKeyVibrancy: VibrancyType? = (self.darkMode ? VibrancyType.DarkSpecial : VibrancyType.LightSpecial)
            let normalKeyVibrancy: VibrancyType? = (self.darkMode ? VibrancyType.DarkRegular : nil)
            
            for (h, page) in enumerate(keyboard.pages) {
    Severity: Minor
    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 3 hrs 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

    Function setAppearanceForKey has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        func setAppearanceForKey(key: KeyboardKey, model: Key, darkMode: Bool, solidColorMode: Bool) {
            if model.type == Key.KeyType.Other {
                self.setAppearanceForOtherKey(key, model: model, darkMode: darkMode, solidColorMode: solidColorMode)
            }
            
    Severity: Minor
    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 2 hrs 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

    Function setAppearanceForKey has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func setAppearanceForKey(key: KeyboardKey, model: Key, darkMode: Bool, solidColorMode: Bool) {
            if model.type == Key.KeyType.Other {
                self.setAppearanceForOtherKey(key, model: model, darkMode: darkMode, solidColorMode: solidColorMode)
            }
            
    Severity: Major
    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 2 hrs to fix

      Function layoutKeys has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func layoutKeys(model: Keyboard, views: [Key:KeyboardKey], bounds: CGRect) {
              if bounds.height == 0 || bounds.width == 0 {
                  return
              }
              
      Severity: Major
      Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 2 hrs to fix

        Function layoutSpecialKeysRow has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            func layoutSpecialKeysRow(row: [Key], modelToView: [Key:KeyboardKey], gapWidth: CGFloat, leftSideRatio: CGFloat, rightSideRatio: CGFloat, frame: CGRect) {
                var keysBeforeSpace = 0
                var keysAfterSpace = 0
                var reachedSpace = false
                for (k, key) in enumerate(row) {
        Severity: Minor
        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 2 hrs 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

        Function layoutSpecialKeysRow has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func layoutSpecialKeysRow(row: [Key], modelToView: [Key:KeyboardKey], gapWidth: CGFloat, leftSideRatio: CGFloat, rightSideRatio: CGFloat, frame: CGRect) {
                var keysBeforeSpace = 0
                var keysAfterSpace = 0
                var reachedSpace = false
                for (k, key) in enumerate(row) {
        Severity: Minor
        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 1 hr to fix

          Function layoutCharacterWithSidesRow has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              func layoutCharacterWithSidesRow(row: [Key], modelToView: [Key:KeyboardKey], keyWidth: CGFloat, gapWidth: CGFloat, mostCharactersInRowInAllPages: Int, m: CGFloat, c: CGFloat, frame: CGRect) {
                  let keySpace = CGFloat(mostCharactersInRowInAllPages) * keyWidth + CGFloat(mostCharactersInRowInAllPages - 1) * gapWidth
                  let numCharacters = row.count - 2
                  let actualKeyWidth = (keySpace - CGFloat(numCharacters - 1) * gapWidth) / CGFloat(numCharacters)
                  let sideSpace = (frame.width - keySpace) / CGFloat(2)
          Severity: Minor
          Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 1 hr 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

          Function layoutCharacterWithSidesRow has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func layoutCharacterWithSidesRow(row: [Key], modelToView: [Key:KeyboardKey], keyWidth: CGFloat, gapWidth: CGFloat, mostCharactersInRowInAllPages: Int, m: CGFloat, c: CGFloat, frame: CGRect) {
                  let keySpace = CGFloat(mostCharactersInRowInAllPages) * keyWidth + CGFloat(mostCharactersInRowInAllPages - 1) * gapWidth
                  let numCharacters = row.count - 2
                  let actualKeyWidth = (keySpace - CGFloat(numCharacters - 1) * gapWidth) / CGFloat(numCharacters)
                  let sideSpace = (frame.width - keySpace) / CGFloat(2)
          Severity: Minor
          Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 1 hr to fix

            Function willShowPopup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                func willShowPopup(key: KeyboardKey, direction: Direction) {
                    // TODO: actual numbers, not standins
                    if let popup = key.popup {
                        // TODO: total hack
                        let actualSuperview = (self.superview.superview != nil ? self.superview.superview! : self.superview)
            Severity: Minor
            Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 1 hr 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

            Function layoutCharacterWithSidesRow has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                func layoutCharacterWithSidesRow(row: [Key], modelToView: [Key:KeyboardKey], keyWidth: CGFloat, gapWidth: CGFloat, mostCharactersInRowInAllPages: Int, m: CGFloat, c: CGFloat, frame: CGRect) {
            Severity: Major
            Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (j < numKeys) {
                                          var key = page.rows[i][j]
                                          
                                          var keyView = self.createKey(key, vibrancy: key.isSpecial ? specialKeyVibrancy : normalKeyVibrancy)
                                          
              Severity: Major
              Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 45 mins to fix

                Function specialKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    class func specialKey(darkMode: Bool, solidColorMode: Bool) -> UIColor {
                        if darkMode {
                            if solidColorMode {
                                return self.darkModeSolidColorSpecialKey
                            }
                Severity: Minor
                Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 45 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

                Function layoutSpecialKeysRow has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    func layoutSpecialKeysRow(row: [Key], modelToView: [Key:KeyboardKey], gapWidth: CGFloat, leftSideRatio: CGFloat, rightSideRatio: CGFloat, frame: CGRect) {
                Severity: Minor
                Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 45 mins to fix

                  Function layoutCharacterRow has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      func layoutCharacterRow(row: [Key], modelToView: [Key:KeyboardKey], keyWidth: CGFloat, gapWidth: CGFloat, frame: CGRect) {
                  Severity: Minor
                  Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return self.rounded(returnHeight)
                    Severity: Major
                    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return self.rounded(returnWidth)
                      Severity: Major
                      Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift - About 30 mins to fix

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

                            class var darkModeSolidColorSpecialKey: UIColor { get { return UIColor(red: CGFloat(45)/CGFloat(255), green: CGFloat(45)/CGFloat(255), blue: CGFloat(45)/CGFloat(255), alpha: 1) }}
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 161..161
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 163..163
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 166..166
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 168..168

                        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 81.

                        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

                            class var darkModeShiftKeyDown: UIColor { get { return UIColor(red: CGFloat(214)/CGFloat(255), green: CGFloat(220)/CGFloat(255), blue: CGFloat(208)/CGFloat(255), alpha: 1) }}
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 161..161
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 163..163
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 165..165
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 168..168

                        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 81.

                        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

                            class var lightModeSolidColorSpecialKey: UIColor { get { return UIColor(red: CGFloat(180)/CGFloat(255), green: CGFloat(188)/CGFloat(255), blue: CGFloat(201)/CGFloat(255), alpha: 1) }}
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 161..161
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 165..165
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 166..166
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 168..168

                        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 81.

                        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

                            class var darkModeSolidColorRegularKey: UIColor { get { return UIColor(red: CGFloat(83)/CGFloat(255), green: CGFloat(83)/CGFloat(255), blue: CGFloat(83)/CGFloat(255), alpha: 1) }}
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 163..163
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 165..165
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 166..166
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 168..168

                        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 81.

                        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

                            class var darkModeUnderColor: UIColor { get { return UIColor(red: CGFloat(38.6)/CGFloat(255), green: CGFloat(18)/CGFloat(255), blue: CGFloat(39.3)/CGFloat(255), alpha: 0.4) }}
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 161..161
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 163..163
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 165..165
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 166..166

                        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 81.

                        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

                        //
                        //  KeyboardLayout.swift
                        //  TransliteratingKeyboard
                        //
                        //  Created by Alexei Baboulevitch on 7/25/14.
                        Severity: Minor
                        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift and 1 other location - About 45 mins to fix
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 1..652

                        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 56.

                        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

                                        if k == 0 {
                                            view.frame = CGRectMake(rounded(currentOrigin), frame.origin.y, specialCharacterWidth, frame.height)
                                            currentOrigin += (specialCharacterWidth + specialCharacterGap)
                                        }
                                        else if k == row.count - 1 {
                        Severity: Minor
                        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift and 2 other locations - About 40 mins to fix
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 499..505
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 588..595

                        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 48.

                        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

                                        else if beforeSpace {
                                            view.frame = CGRectMake(rounded(currentOrigin), frame.origin.y, leftButtonWidth, frame.height)
                                            currentOrigin += (leftButtonWidth + gapWidth)
                                        }
                                        else {
                        Severity: Minor
                        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift and 2 other locations - About 40 mins to fix
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 499..505
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 524..541

                        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 48.

                        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

                                    if let view = modelToView[key] {
                                        view.frame = CGRectMake(rounded(currentOrigin), frame.origin.y, keyWidth, frame.height)
                                        currentOrigin += (keyWidth + gapWidth)
                                    }
                                    else {
                        Severity: Minor
                        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift and 2 other locations - About 40 mins to fix
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 524..541
                        ios-newsstand-app/newsstand-app/Keyboard/KeyboardLayout.swift on lines 588..595

                        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 48.

                        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