hackedteam/core-ios

View on GitHub

Showing 104 of 104 total issues

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

    bezierPath.addCurveToPoint(CGPointMake(16 * xScalingFactor, 0 * yScalingFactor), controlPoint1: CGPointMake(32 * xScalingFactor, 0 * yScalingFactor), controlPoint2: CGPointMake(16 * xScalingFactor, 0 * yScalingFactor))
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift and 11 other locations - About 55 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 168..168
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 169..169
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 170..170
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 229..229
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 230..230
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 231..231
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 232..232
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 292..292
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 303..303
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 314..314
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 325..325

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

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

    bezierPath.addCurveToPoint(CGPointMake(24 * xScalingFactor, 32 * yScalingFactor), controlPoint1: CGPointMake(16 * xScalingFactor, 32 * yScalingFactor), controlPoint2: CGPointMake(24 * xScalingFactor, 32 * yScalingFactor))
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift and 11 other locations - About 55 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 168..168
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 169..169
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 170..170
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 171..171
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 229..229
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 231..231
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 232..232
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 292..292
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 303..303
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 314..314
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 325..325

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

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

    bezier5Path.addCurveToPoint(CGPointMake(34 * xScalingFactor, 7 * yScalingFactor), controlPoint1: CGPointMake(6 * xScalingFactor, 7 * yScalingFactor), controlPoint2: CGPointMake(19 * xScalingFactor, 21 * yScalingFactor))
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift and 11 other locations - About 55 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 168..168
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 169..169
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 170..170
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 171..171
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 229..229
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 230..230
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 231..231
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 232..232
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 292..292
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 303..303
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 325..325

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

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

    bezierPath.addCurveToPoint(CGPointMake(44 * xScalingFactor, 6 * yScalingFactor), controlPoint1: CGPointMake(44 * xScalingFactor, 22 * yScalingFactor), controlPoint2: CGPointMake(44 * xScalingFactor, 6 * yScalingFactor))
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift and 11 other locations - About 55 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 168..168
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 170..170
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 171..171
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 229..229
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 230..230
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 231..231
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 232..232
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 292..292
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 303..303
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 314..314
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 325..325

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

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

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

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

            shape.frame = CGRectMake(
                CGFloat((self.bounds.width - size.width) / 2.0),
                CGFloat((self.bounds.height - size.height) / 2.0),
                size.width,
                size.height)
Severity: Minor
Found in ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.swift and 1 other location - About 50 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift on lines 86..90

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

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

        self.overflowCanvas.frame = CGRectMake(
            CGFloat((self.bounds.width - overflowCanvasSize.width) / 2.0),
            CGFloat((self.bounds.height - overflowCanvasSize.height) / 2.0),
            overflowCanvasSize.width,
            overflowCanvasSize.height)
Severity: Minor
Found in ios-newsstand-app/newsstand-app/Keyboard/Shapes.swift and 1 other location - About 50 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/KeyboardKey.swift on lines 373..377

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

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

    for key in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] {
        var keyModel = Key(.SpecialCharacter)
        keyModel.setLetter(key)
        defaultKeyboard.addKey(keyModel, row: 0, page: 1)
    }
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift and 4 other locations - About 45 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 12..16
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 62..66
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 92..96
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 98..102

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

            underPath.addArcWithCenter(CGPointMake(self.arcCenters[0].x, self.arcCenters[0].y - self.underOffset), radius: CGFloat(self.cornerRadius), startAngle: startAngle, endAngle: endAngle, clockwise: false)
ios-newsstand-app/newsstand-app/Keyboard/KeyboardKeyBackground.swift on lines 295..295

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

    for key in ["[", "]", "{", "}", "#", "%", "^", "*", "+", "="] {
        var keyModel = Key(.SpecialCharacter)
        keyModel.setLetter(key)
        defaultKeyboard.addKey(keyModel, row: 0, page: 2)
    }
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift and 4 other locations - About 45 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 12..16
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 56..60
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 62..66
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 98..102

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

            underPath.addArcWithCenter(CGPointMake(self.arcCenters[3].x, self.arcCenters[3].y - self.underOffset), radius: CGFloat(self.cornerRadius), startAngle: startAngle, endAngle: endAngle, clockwise: false)
ios-newsstand-app/newsstand-app/Keyboard/KeyboardKeyBackground.swift on lines 289..289

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

    for key in ["-", "/", ":", ";", "(", ")", "$", "&", "@", "\""] {
        var keyModel = Key(.SpecialCharacter)
        keyModel.setLetter(key)
        defaultKeyboard.addKey(keyModel, row: 1, page: 1)
    }
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift and 4 other locations - About 45 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 12..16
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 56..60
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 92..96
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 98..102

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

    for key in ["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"] {
        var keyModel = Key(.Character)
        keyModel.setLetter(key)
        defaultKeyboard.addKey(keyModel, row: 0, page: 0)
    }
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift and 4 other locations - About 45 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 56..60
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 62..66
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 92..96
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 98..102

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

    for key in ["_", "\\", "|", "~", "<", ">", "€", "£", "Y", "•"] {
        var keyModel = Key(.SpecialCharacter)
        keyModel.setLetter(key)
        defaultKeyboard.addKey(keyModel, row: 1, page: 2)
    }
Severity: Major
Found in ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift and 4 other locations - About 45 mins to fix
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 12..16
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 56..60
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 62..66
ios-newsstand-app/newsstand-app/Keyboard/DefaultKeyboard.swift on lines 92..96

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

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
      Severity
      Category
      Status
      Source
      Language