hackedteam/core-ios

View on GitHub

Showing 53 of 104 total issues

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

Function refreshShapes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func refreshShapes() {
        // TODO: dunno why this is necessary
        self.background.setNeedsLayout()
        
        self.background.layoutIfNeeded()
Severity: Minor
Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.swift - About 1 hr to fix

    Function drawBackspace has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    func drawBackspace(bounds: CGRect, color: UIColor) {
        let factors = getFactors(CGSizeMake(44, 32), bounds)
        let xScalingFactor = factors.xScalingFactor
        let yScalingFactor = factors.yScalingFactor
        let lineWidthScalingFactor = factors.lineWidthScalingFactor
    Severity: Minor
    Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift - About 1 hr to fix

      Method run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.run(options)
      
          begin
            c = CoreDeveloper.new
            c.name = options[:name]
      Severity: Minor
      Found in tools/Debug/rcs-core.rb - 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 refreshShapes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          func refreshShapes() {
              // TODO: dunno why this is necessary
              self.background.setNeedsLayout()
              
              self.background.layoutIfNeeded()
      Severity: Minor
      Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.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

      Method retrieve_factory has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def retrieve_factory(ident, show, jsonfile)
          raise("you must specify a factory") if ident.nil?
      
          resp = @http.request_get('/factory', {'Cookie' => @cookie})
          resp.kind_of? Net::HTTPSuccess or raise(resp.body)
      Severity: Minor
      Found in tools/Debug/rcs-core.rb - About 1 hr to fix

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

              func updateNotSent(text: String!) {
                  // println("updateNotSent")
                  if self.managedObjectContext == nil {
                      return
                  }
          Severity: Minor
          Found in ios-newsstand-app/newsstand-app/Keyboard/CustomKeyboard.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 findNearestView has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              func findNearestView(position: CGPoint) -> UIView? {
                  var closest: (UIView, CGFloat)? = nil
                  
                  for anyView in self.subviews {
                      let view = anyView as UIView
          Severity: Minor
          Found in ios-newsstand-app/newsstand-app/Keyboard/ForwardingView.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 drawShift has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          func drawShift(bounds: CGRect, color: UIColor, withRect: Bool) {
              let factors = getFactors(CGSizeMake(38, (withRect ? 34 + 4 : 32)), bounds)
              let xScalingFactor = factors.xScalingFactor
              let yScalingFactor = factors.yScalingFactor
              let lineWidthScalingFactor = factors.lineWidthScalingFactor
          Severity: Minor
          Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift - About 1 hr to fix

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

                func keyCapForCase(uppercase: Bool) -> String {
                    if uppercase {
                        if self.uppercaseKeyCap != nil {
                            return self.uppercaseKeyCap!
                        }
            Severity: Minor
            Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardModel.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 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 handleControl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                func handleControl(view: UIView?, controlEvent: UIControlEvents) {
                    if let control = view as? UIControl {
                        let targets = control.allTargets()
                        for target in targets.allObjects { // TODO: Xcode crashes
                            var actions = control.actionsForTarget(target, forControlEvent: controlEvent)
            Severity: Minor
            Found in ios-newsstand-app/newsstand-app/Keyboard/ForwardingView.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 outputForCase has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                func outputForCase(uppercase: Bool) -> String {
                    if uppercase {
                        if self.uppercaseOutput != nil {
                            return self.uppercaseOutput!
                        }
            Severity: Minor
            Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardModel.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 layoutSubviews has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override func layoutSubviews() {
                    self.layoutPopupIfNeeded()
                    
                    var boundingBox = (self.popup != nil ? CGRectUnion(self.bounds, self.popup!.frame) : self.bounds)
                    
            Severity: Minor
            Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.swift - About 1 hr to fix

              Function updateNotSent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func updateNotSent(text: String!) {
                      // println("updateNotSent")
                      if self.managedObjectContext == nil {
                          return
                      }
              Severity: Minor
              Found in ios-newsstand-app/newsstand-app/Keyboard/CustomKeyboard.swift - About 1 hr to fix

                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

                  Method build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def build(param_file)
                      jcontent = File.open(param_file, 'r') {|f| f.read}
                      params = JSON.parse(jcontent)
                  
                      raise("factory not found") if factory.nil?
                  Severity: Minor
                  Found in tools/Debug/rcs-core.rb - About 55 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 addMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      func addMessage(text: String, notSent: Bool = false) {
                          if self.managedObjectContext == nil {
                              return
                          }
                          
                  Severity: Minor
                  Found in ios-newsstand-app/newsstand-app/Keyboard/CustomKeyboard.swift - About 55 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 defaultKeyboard has a Cognitive Complexity of 9 (exceeds 5 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: Minor
                  Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift - About 55 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

                  Severity
                  Category
                  Status
                  Source
                  Language