namelivia/flappysonic-client

View on GitHub

Showing 13 of 13 total issues

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

test('should not kill player if is not colliding and in the screen', () => {
    thereIsACollisionMock.mockReturnValue(false)
    isOutOfBoundsMock.mockReturnValue(false)
    const level = initializeLevel()
    level.start()
Severity: Major
Found in src/Level/Level.test.js and 2 other locations - About 2 hrs to fix
src/Level/Level.test.js on lines 34..40
src/Level/Level.test.js on lines 42..48

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

test('should kill player when collides enemies', () => {
    thereIsACollisionMock.mockReturnValue(true)
    isOutOfBoundsMock.mockReturnValue(false)
    const level = initializeLevel()
    level.start()
Severity: Major
Found in src/Level/Level.test.js and 2 other locations - About 2 hrs to fix
src/Level/Level.test.js on lines 26..32
src/Level/Level.test.js on lines 42..48

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

test('should kill player when its out of bounds', () => {
    thereIsACollisionMock.mockReturnValue(false)
    isOutOfBoundsMock.mockReturnValue(true)
    const level = initializeLevel()
    level.start()
Severity: Major
Found in src/Level/Level.test.js and 2 other locations - About 2 hrs to fix
src/Level/Level.test.js on lines 26..32
src/Level/Level.test.js on lines 34..40

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

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

test('should create e new level when starting', () => {
    const game = initalizeGame()
    game.init()
    game.restart()
    expect(levelFactory).toHaveBeenCalledTimes(1)
Severity: Major
Found in src/Game/Game.test.js and 1 other location - About 2 hrs to fix
src/Game/Game.test.js on lines 55..62

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

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

test('should restar on the click callback', () => {
    const game = initalizeGame()
    game.init()
    game.restartOnClick()
    expect(levelFactory).toHaveBeenCalledTimes(1)
Severity: Major
Found in src/Game/Game.test.js and 1 other location - About 2 hrs to fix
src/Game/Game.test.js on lines 64..71

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

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

test('updating data while going straight', () => {
    const sonic = initializeSonic(20, 10, 2)
    updateSonic(sonic, STATE_ALIVE)
    assertSonicStatus(sonic, 20, 18, 0)
    expect(gotoAndPlayMock).toHaveBeenCalledTimes(1)
Severity: Major
Found in src/Sonic/Sonic.test.js and 1 other location - About 1 hr to fix
src/Sonic/Sonic.test.js on lines 46..52

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

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

test('updating data while going down', () => {
    const sonic = initializeSonic(20, 10, 0)
    updateSonic(sonic, STATE_ALIVE)
    assertSonicStatus(sonic, 20, 20, 0)
    expect(gotoAndPlayMock).toHaveBeenCalledTimes(1)
Severity: Major
Found in src/Sonic/Sonic.test.js and 1 other location - About 1 hr to fix
src/Sonic/Sonic.test.js on lines 38..44

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

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

    checkPixelCollision(bitmap1, bitmap2) {
        var imageData1, imageData2, pixelIntersection
        var intersection = this._checkRectCollision(bitmap1, bitmap2)
        if (!intersection) {
            return false
Severity: Minor
Found in src/Collision/Collision.js - About 1 hr to fix

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

    export const sonic = jest.fn().mockImplementation(() => {
        return {
            tick: tickMock,
            die: dieMock,
            isOutOfBounds: isOutOfBoundsMock,
    Severity: Major
    Found in src/Factory/__mocks__/Factory.js and 2 other locations - About 40 mins to fix
    src/Factory/__mocks__/Factory.js on lines 19..25
    src/Factory/__mocks__/Factory.js on lines 65..71

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export const enemies = jest.fn().mockImplementation(() => {
        return {
            tick: tickMock,
            areSurpassed: areSurpassedMock,
            areColliding: areCollidingMock,
    Severity: Major
    Found in src/Factory/__mocks__/Factory.js and 2 other locations - About 40 mins to fix
    src/Factory/__mocks__/Factory.js on lines 19..25
    src/Factory/__mocks__/Factory.js on lines 50..56

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export const preloader = jest.fn().mockImplementation(() => {
        return {
            load: loadMock,
            getProgress: getProgressMock,
            getResult: getResultMock,
    Severity: Major
    Found in src/Factory/__mocks__/Factory.js and 2 other locations - About 40 mins to fix
    src/Factory/__mocks__/Factory.js on lines 50..56
    src/Factory/__mocks__/Factory.js on lines 65..71

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

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

        _getParentalCumulatedProperty(child, propName, operation) {
            operation = operation || '+'
            if (child.parent && child.parent[propName]) {
                var cp = child[propName]
                var pp = this._getParentalCumulatedProperty(
    Severity: Minor
    Found in src/Collision/Collision.js - About 35 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 _compareAlphaValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        _compareAlphaValues(imageData1, imageData2, width, height) {
            var offset = 3
    
            // parsing through the pixels checking for an alpha match
            // TODO: intelligent parsing, not just from 0 to end!
    Severity: Minor
    Found in src/Collision/Collision.js - About 25 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