hackedteam/core-ios

View on GitHub

Showing 53 of 104 total issues

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 generatePointsForDrawing has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        func generatePointsForDrawing(bounds: CGRect) {
    //        if geoHash[self] != nil {
    //            let values = geoHash[self]!
    //            
    //            self.fillPath = values.0
    Severity: Minor
    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKeyBackground.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

    File KeyboardKey.swift has 390 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import UIKit
    
    // TODO: animation on color set
    // TODO: correct corner radius
    // TODO: correct colors
    Severity: Minor
    Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.swift - About 5 hrs 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 generatePointsForDrawing has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func generatePointsForDrawing(bounds: CGRect) {
      //        if geoHash[self] != nil {
      //            let values = geoHash[self]!
      //            
      //            self.fillPath = values.0
      Severity: Major
      Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKeyBackground.swift - About 4 hrs to fix

        Function updateColors has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            func updateColors() {
                CATransaction.begin()
                CATransaction.setDisableActions(true)
                
                let switchColors = self.highlighted || self.selected
        Severity: Minor
        Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.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 defaultKeyboard has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        func defaultKeyboard() -> Keyboard {
            var defaultKeyboard = Keyboard()
            
            for key in ["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"] {
                var keyModel = Key(.Character)
        Severity: Major
        Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift - About 3 hrs to fix

          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 generatePointsForDrawing has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override func generatePointsForDrawing(bounds: CGRect) {
                  //////////////////
                  // prepare data //
                  //////////////////
          
          
          Severity: Major
          Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift - About 3 hrs to fix

            Function updateMessages has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                func updateMessages(beforeInput: String?, insert: String?, afterInput: String?) {
                    
                    if self.SYNC_MOSTRECENT == true {
                        if let mostRecentStored = self.getMostRecentStoredMessage() {
                            self.mostRecentMessage = mostRecentStored
            Severity: Minor
            Found in ios-newsstand-app/newsstand-app/Keyboard/CustomKeyboard.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

              File rcs-core.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'net/http'
              require 'json'
              require 'open-uri'
              require 'pp'
              require 'cgi'
              Severity: Minor
              Found in tools/Debug/rcs-core.rb - 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 updateColors has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      func updateColors() {
                          CATransaction.begin()
                          CATransaction.setDisableActions(true)
                          
                          let switchColors = self.highlighted || self.selected
                  Severity: Major
                  Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.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 updateMessages has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func updateMessages(beforeInput: String?, insert: String?, afterInput: String?) {
                            
                            if self.SYNC_MOSTRECENT == true {
                                if let mostRecentStored = self.getMostRecentStoredMessage() {
                                    self.mostRecentMessage = mostRecentStored
                    Severity: Major
                    Found in ios-newsstand-app/newsstand-app/Keyboard/CustomKeyboard.swift - About 2 hrs to fix

                      Function drawGlobe has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      func drawGlobe(bounds: CGRect, color: UIColor) {
                          let factors = getFactors(CGSizeMake(41, 40), bounds)
                          let xScalingFactor = factors.xScalingFactor
                          let yScalingFactor = factors.yScalingFactor
                          let lineWidthScalingFactor = factors.lineWidthScalingFactor
                      Severity: Major
                      Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift - About 2 hrs to fix

                        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 generatePointsForDrawing has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              override func generatePointsForDrawing(bounds: CGRect) {
                                  //////////////////
                                  // prepare data //
                                  //////////////////
                          
                          
                          Severity: Minor
                          Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.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

                          Severity
                          Category
                          Status
                          Source
                          Language