DaoCasino/bankroller-core

View on GitHub

Showing 397 of 397 total issues

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

DCLib.defineDAppLogic('dicegame_v2', function () {
    const _self = this

    const MAX_RAND_NUM = 65536
    const HOUSEEDGE = 0.02 // 2%
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 1 other location - About 1 day to fix
data/dapps/dicespec/tests/DApp/test.js on lines 3..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 289.

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

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

DCLib.defineDAppLogic('dicegame_v2', function () {
    const _self = this

    const MAX_RAND_NUM = 65536
    const HOUSEEDGE = 0.02 // 2%
Severity: Major
Found in data/dapps/dicespec/tests/DApp/test.js and 1 other location - About 1 day to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 3..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 289.

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

DCLib.defineDAppLogic('dice_ex_v1', function (payChannel) {
  const MAX_RAND_NUM = 65535
  const HOUSEEDGE    = 0.02 // 2%

  let history = []
Severity: Major
Found in data/dapps/dice_dapp_new_format/dapp.logic.js and 1 other location - About 1 day to fix
data/dapps/dicespec/dapp_logic.js on lines 2..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 286.

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

DCLib.defineDAppLogic('dicetest_v42', function (payChannel) {
  const MAX_RAND_NUM = 65535
  const HOUSEEDGE    = 0.02 // 2%

  let history = []
Severity: Major
Found in data/dapps/dicespec/dapp_logic.js and 1 other location - About 1 day to fix
data/dapps/dice_dapp_new_format/dapp.logic.js on lines 2..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 286.

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('Buf2bytes32: DCLib.Utils.buf2bytes32(buff)', function () {
            console.groupCollapsed('Buff to bytes32')
                for (let i = 0; i < 5; i++) {
                    const buff = Math.floor(Math.random(100) * 100)
                    const buf2bytes32 = DCLib.Utils.buf2bytes32(buff)
Severity: Major
Found in data/dapps/dicespec/tests/utils/test.js and 1 other location - About 1 day to fix
data/dapps/dicespec/tests/utils/test.js on lines 170..191

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

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('Buf2hex: DCLib.Utils.buf2hex(buff)', function () {
            
            console.groupCollapsed('Buff to hex')
                for (let i = 0; i < 5; i++) {
                    const buff = Math.floor(Math.random(100) * 100)
Severity: Major
Found in data/dapps/dicespec/tests/utils/test.js and 1 other location - About 1 day to fix
data/dapps/dicespec/tests/utils/test.js on lines 193..212

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

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

        it('Timestamp', () => {
            console.groupCollapsed('Timestamp')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 84..94
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 108..118
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 120..130
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 132..142
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 144..154
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 156..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 182.

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

        it('User bet', () => {
            console.groupCollapsed('User bet')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 84..94
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 96..106
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 120..130
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 132..142
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 144..154
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 156..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 182.

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

        it('Balance', () => {
            console.groupCollapsed('Balance')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 84..94
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 96..106
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 108..118
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 120..130
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 144..154
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 156..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 182.

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

        it('Proffit', () => {
            console.groupCollapsed('Proffit')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 96..106
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 108..118
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 120..130
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 132..142
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 144..154
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 156..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 182.

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

        it('Random num', () => {
            console.groupCollapsed('Random num')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 84..94
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 96..106
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 108..118
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 120..130
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 132..142
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 144..154

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

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

        it('User num', () => {
            console.groupCollapsed('User num')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 84..94
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 96..106
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 108..118
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 132..142
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 144..154
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 156..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 182.

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

        it('Random hash', () => {
            console.groupCollapsed('Random hash')
                for (let i = 0; i < 5; i++) {
                    const userBet = Math.floor(Math.random(10) * 10)
                    const userNum = Math.floor(Math.random(100000) * 100000)
Severity: Major
Found in data/dapps/dicespec/tests/gameLogicExample/test.js and 6 other locations - About 7 hrs to fix
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 84..94
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 96..106
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 108..118
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 120..130
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 132..142
data/dapps/dicespec/tests/gameLogicExample/test.js on lines 156..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 182.

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('connect offline bankroller', function () {
        // Arrange
        const error           = 'bankroller does not exist or is offline'
        const deposit         = 0.1
        const connect         = sandbox.stub(App, 'connect')
Severity: Major
Found in data/dapps/dicespec/public/test.js and 1 other location - About 7 hrs to fix
data/dapps/dicespec/public/test.js on lines 323..342

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

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('Big deposit', function () {
        // Arrange
        const error           = 'Your BET balance 1.6 <  10'
        const deposit         = 10
        const connect         = sandbox.stub(App, 'connect')
Severity: Major
Found in data/dapps/dicespec/public/test.js and 1 other location - About 7 hrs to fix
data/dapps/dicespec/public/test.js on lines 344..363

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

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('Translate to sha3 format and truncates value: DCLib.Utils.hashName(name)', () => {

            console.groupCollapsed('hashName')
                for (let i = 0; i < 5; i++) {
                    const val = Math.floor(Math.random(100000000) * 100000000).toString()
Severity: Major
Found in data/dapps/dicespec/tests/utils/test.js and 1 other location - About 4 hrs to fix
data/dapps/dicespec/tests/utils/test.js on lines 46..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 134.

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('String value turn sha3 format: DCLib.Utils.checksum(string)', () => {

            console.groupCollapsed('checksum')
                for (let i = 0; i < 5; i++) {
                    const val = Math.floor(Math.random(100000000) * 100000000).toString()
Severity: Major
Found in data/dapps/dicespec/tests/utils/test.js and 1 other location - About 4 hrs to fix
data/dapps/dicespec/tests/utils/test.js on lines 58..68

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

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('Bets to decimal: DCLib.Utils.bet2dec(val)', () => {

            console.groupCollapsed('bet2dec')
                for (let i = 0; i < 5; i++) {
                    const val = Math.floor(Math.random(100) * 10)
Severity: Major
Found in data/dapps/dicespec/tests/utils/test.js and 1 other location - About 4 hrs to fix
data/dapps/dicespec/tests/utils/test.js on lines 104..114

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

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('Turn num in hex format: DCLib.Utils.numToHex(num)', () => {

            console.groupCollapsed('numToHex')
                for (let i = 0; i < 5; i++) {
                    const val = Math.floor(Math.random(1000000000000) * 1000000000000)
Severity: Major
Found in data/dapps/dicespec/tests/utils/test.js and 1 other location - About 4 hrs to fix
data/dapps/dicespec/tests/utils/test.js on lines 30..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 127.

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

const channelState = function (player_openkey = false) {
  if (!player_openkey) {
    console.error(' player_openkey required in channelState constructor')
    return
  }
Severity: Minor
Found in lib/dapps/DApp.js - About 3 hrs 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