hackedteam/core-ios

View on GitHub

Showing 104 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

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

    func outputForCase(uppercase: Bool) -> String {
        if uppercase {
            if self.uppercaseOutput != nil {
                return self.uppercaseOutput!
            }
ios-newsstand-app/newsstand-app/Keyboard/KeyboardModel.swift on lines 162..185

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

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

    func keyCapForCase(uppercase: Bool) -> String {
        if uppercase {
            if self.uppercaseKeyCap != nil {
                return self.uppercaseKeyCap!
            }
ios-newsstand-app/newsstand-app/Keyboard/KeyboardModel.swift on lines 137..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 113.

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

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

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

                  bezierPath.addCurveToPoint(
                      myConvertedEndPoints.1,
                      controlPoint1: (isVertical ?
                          CGPointMake(myConvertedStartPoints.0.x, midpoint) :
                          CGPointMake(midpoint, myConvertedStartPoints.0.y)),
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 149..156
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 162..169
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 174..181

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

          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 4 locations. Consider refactoring.
          Open

                  currentEdgePath.addCurveToPoint(
                      myConvertedStartPoints.1,
                      controlPoint1: (isVertical ?
                          CGPointMake(myConvertedEndPoints.0.x, midpoint) :
                          CGPointMake(midpoint, myConvertedEndPoints.0.y)),
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 138..145
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 149..156
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 162..169

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

          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

          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

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

                  currentEdgePath.addCurveToPoint(
                      myConvertedEndPoints.1,
                      controlPoint1: (isVertical ?
                          CGPointMake(myConvertedStartPoints.0.x, midpoint) :
                          CGPointMake(midpoint, myConvertedStartPoints.0.y)),
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 138..145
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 162..169
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 174..181

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

          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 4 locations. Consider refactoring.
          Open

                  bezierPath.addCurveToPoint(
                      myConvertedStartPoints.1,
                      controlPoint1: (isVertical ?
                          CGPointMake(myConvertedEndPoints.0.x, midpoint) :
                          CGPointMake(midpoint, myConvertedEndPoints.0.y)),
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 138..145
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 149..156
          ios-newsstand-app/newsstand-app/Keyboard/KeyboardConnector.swift on lines 174..181

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

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

          Severity
          Category
          Status
          Source
          Language