asdqwex/discobot

View on GitHub
test/modules/dice.spec.js

Summary

Maintainability
B
5 hrs
Test Coverage

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

  it(`rolls a number of sided dice.`, () => {
    const {message: actual} = roller('kingles', '2d10')
    const expected = 'Kingles rolled 2d10! ( 4 + 1 ) = 5'

    assert.equal(actual, expected)
Severity: Major
Found in test/modules/dice.spec.js and 3 other locations - About 1 hr to fix
test/modules/dice.spec.js on lines 59..64
test/modules/dice.spec.js on lines 66..71
test/modules/dice.spec.js on lines 73..78

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

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

  it(`ridicules the user when syntax is invalid`, () => {
    const {message: actual} = roller('kingles', 'ads')
    const expected = 'Kingles doesn\'t understand how rolling dice works.. ads is not a valid dice roll!'

    assert.equal(actual, expected)
Severity: Major
Found in test/modules/dice.spec.js and 3 other locations - About 1 hr to fix
test/modules/dice.spec.js on lines 35..40
test/modules/dice.spec.js on lines 66..71
test/modules/dice.spec.js on lines 73..78

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

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

  it(`handles addition at the end of a roll`, () => {
    const {message: actual} = roller('kingles', '3d10+5')
    const expected = 'Kingles rolled 3d10+5! ( 8 + 10 + 1 ) + 5 = 24'

    assert.equal(actual, expected)
Severity: Major
Found in test/modules/dice.spec.js and 3 other locations - About 1 hr to fix
test/modules/dice.spec.js on lines 35..40
test/modules/dice.spec.js on lines 59..64
test/modules/dice.spec.js on lines 73..78

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

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

  it(`handles counting successes at or more than a given value`, () => {
    const {message: actual} = roller('kingles', '4d10>8')
    const expected = 'Kingles rolled 4d10>8! ( 1 + 3 + 8 + 7 ) = 1 Success'

    assert.equal(actual, expected)
Severity: Major
Found in test/modules/dice.spec.js and 3 other locations - About 1 hr to fix
test/modules/dice.spec.js on lines 35..40
test/modules/dice.spec.js on lines 59..64
test/modules/dice.spec.js on lines 66..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 55.

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

  it('handles counting succcesses at exactly a given value', () => {
    const {message: actual} = roller('kingles', '4d10=9')
    const expected = 'Kingles rolled 4d10=9! ( 2 + 7 + 3 + 9 ) = 1 Success'

    assert.equal(actual, expected)
Severity: Minor
Found in test/modules/dice.spec.js and 1 other location - About 45 mins to fix
test/modules/dice.spec.js on lines 80..85

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

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

  it('handles counting successes less than a given value', () => {
    const {message: actual} = roller('kingles', '4d10<8')
    const expected = 'Kingles rolled 4d10<8! ( 4 + 10 + 2 + 5 ) = 3 Successes'

    assert.equal(actual, expected)
Severity: Minor
Found in test/modules/dice.spec.js and 1 other location - About 45 mins to fix
test/modules/dice.spec.js on lines 87..92

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

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

Import in body of module; reorder to top.
Open

import assert from 'assert'
Severity: Minor
Found in test/modules/dice.spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Import in body of module; reorder to top.
Open

import sinon from 'sinon'
Severity: Minor
Found in test/modules/dice.spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Import in body of module; reorder to top.
Open

import Random from 'random-js'
Severity: Minor
Found in test/modules/dice.spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

There are no issues that match your filters.

Category
Status