DaoCasino/bankroller-core

View on GitHub

Showing 397 of 397 total issues

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

      it('Export private key with password', function () {
        this.timeout(3000)
        const exportPrivateKey = DCLib.Account.exportPrivateKey('1234')
        console.log('Private key with pass: ', exportPrivateKey)
      })
Severity: Major
Found in data/dapps/dicespec/tests/Account/test.js and 1 other location - About 1 hr to fix
data/dapps/dicespec/tests/Account/test.js on lines 59..63

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

    getBankrollerSigned (hash = false) {
      if (!hash) hash = Object.keys(states).splice(-1)
      return GetState(hash).bankroller
    }
Severity: Major
Found in lib/dapps/DApp.js and 1 other location - About 1 hr to fix
lib/dapps/DApp.js on lines 188..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 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('Add TX', () => {
            const updateChannelBalance = window.MyDApp.logic.payChannel.updateChannelBalance(0.2)
            console.log('Function addTX: ', updateChannelBalance)
        })
Severity: Minor
Found in data/dapps/dicespec/tests/payChannel/test.js and 1 other location - About 50 mins to fix
data/dapps/dicespec/tests/payChannel/test.js on lines 15..18

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

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('Set deposit', () => {
            const setDeposit = window.MyDApp.logic.payChannel.setDeposit(1)
            console.log('Function setDeposit: ', setDeposit)
        })
Severity: Minor
Found in data/dapps/dicespec/tests/payChannel/test.js and 1 other location - About 50 mins to fix
data/dapps/dicespec/tests/payChannel/test.js on lines 40..43

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

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

        it('Get deposit', () => {
            const getDeposit = window.MyDApp.logic.payChannel.getDeposit()
            console.log('Function getDeposit: ', getDeposit)
        })
Severity: Major
Found in data/dapps/dicespec/tests/payChannel/test.js and 2 other locations - About 50 mins to fix
data/dapps/dicespec/tests/payChannel/test.js on lines 28..31
data/dapps/dicespec/tests/payChannel/test.js on lines 49..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 51.

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

        it('Get balance', () => {
            const getBalance = window.MyDApp.logic.payChannel.getBalance()
            console.log('Function getBalance: ', getBalance)
        })
Severity: Major
Found in data/dapps/dicespec/tests/payChannel/test.js and 2 other locations - About 50 mins to fix
data/dapps/dicespec/tests/payChannel/test.js on lines 23..26
data/dapps/dicespec/tests/payChannel/test.js on lines 49..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 51.

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

        it('Reset', () => {
            const reset = window.MyDApp.logic.payChannel.reset()
            console.log('Function reset: ', reset)
        })
Severity: Major
Found in data/dapps/dicespec/tests/payChannel/test.js and 2 other locations - About 50 mins to fix
data/dapps/dicespec/tests/payChannel/test.js on lines 23..26
data/dapps/dicespec/tests/payChannel/test.js on lines 28..31

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

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

  loadDApp (key) {
    const readManifest = function (file_path) {
      const tryReadFile = (path) => {
        try {
          let dapp_config = JSON.parse(fs.readFileSync(path))
Severity: Minor
Found in lib/dapps/dapps.js - 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

Avoid too many return statements within this function.
Open

      return
Severity: Major
Found in lib/dapps/DApp.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return false
    Severity: Major
    Found in lib/dapps/DApp.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          if (!confirmed) return
      Severity: Major
      Found in lib/dapps/DApp.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return
        Severity: Major
        Found in lib/dapps/DApp.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return true
          Severity: Major
          Found in lib/dapps/DApp.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return
            Severity: Major
            Found in lib/dapps/DApp.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return
              Severity: Major
              Found in lib/dapps/DApp.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return false
                Severity: Major
                Found in lib/dapps/DApp.js - About 30 mins to fix

                  Trailing spaces not allowed.
                  Open

                      if (typeof d_conf !== 'object' || d_conf.disable || d_conf.disabled || d_conf.enable === false) return 
                  Severity: Minor
                  Found in lib/dapps/dapps.js by eslint

                  disallow trailing whitespace at the end of lines (no-trailing-spaces)

                  Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before check-in.

                  Rule Details

                  This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines.

                  Examples of incorrect code for this rule:

                  /*eslint no-trailing-spaces: "error"*/
                  
                  var foo = 0;//•••••
                  var baz = 5;//••
                  //•••••

                  Examples of correct code for this rule:

                  /*eslint no-trailing-spaces: "error"*/
                  
                  var foo = 0;
                  var baz = 5;

                  Options

                  This rule has an object option:

                  • "skipBlankLines": false (default) disallows trailing whitespace on empty lines
                  • "skipBlankLines": true allows trailing whitespace on empty lines

                  skipBlankLines

                  Examples of correct code for this rule with the { "skipBlankLines": true } option:

                  /*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/
                  
                  var foo = 0;
                  var baz = 5;
                  //•••••

                  Source: http://eslint.org/docs/rules/

                  Missing space before =>.
                  Open

                  Eth.initAccount(acc=>{
                  Severity: Minor
                  Found in test/checks.js by eslint

                  Require space before/after arrow function's arrow (arrow-spacing)

                  This rule normalize style of spacing before/after an arrow function's arrow(=>).

                  /*eslint-env es6*/
                  
                  // { "before": true, "after": true }
                  (a) => {}
                  
                  // { "before": false, "after": false }
                  (a)=>{}

                  Rule Details

                  This rule takes an object argument with before and after properties, each with a Boolean value.

                  The default configuration is { "before": true, "after": true }.

                  true means there should be one or more spaces and false means no spaces.

                  Examples of incorrect code for this rule with the default { "before": true, "after": true } option:

                  /*eslint arrow-spacing: "error"*/
                  /*eslint-env es6*/
                  
                  ()=> {};
                  () =>{};
                  (a)=> {};
                  (a) =>{};
                  a =>a;
                  a=> a;
                  ()=> {'\n'};
                  () =>{'\n'};

                  Examples of correct code for this rule with the default { "before": true, "after": true } option:

                  /*eslint arrow-spacing: "error"*/
                  /*eslint-env es6*/
                  
                  () => {};
                  (a) => {};
                  a => a;
                  () => {'\n'};

                  Examples of incorrect code for this rule with the { "before": false, "after": false } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
                  /*eslint-env es6*/
                  
                  () =>{};
                  (a) => {};
                  ()=> {'\n'};

                  Examples of correct code for this rule with the { "before": false, "after": false } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
                  /*eslint-env es6*/
                  
                  ()=>{};
                  (a)=>{};
                  ()=>{'\n'};

                  Examples of incorrect code for this rule with the { "before": false, "after": true } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
                  /*eslint-env es6*/
                  
                  () =>{};
                  (a) => {};
                  ()=>{'\n'};

                  Examples of correct code for this rule with the { "before": false, "after": true } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
                  /*eslint-env es6*/
                  
                  ()=> {};
                  (a)=> {};
                  ()=> {'\n'};

                  Source: http://eslint.org/docs/rules/

                  Missing space before =>.
                  Open

                        this.getBalances(this.acc.address, r=>{
                  Severity: Minor
                  Found in lib/Eth.js by eslint

                  Require space before/after arrow function's arrow (arrow-spacing)

                  This rule normalize style of spacing before/after an arrow function's arrow(=>).

                  /*eslint-env es6*/
                  
                  // { "before": true, "after": true }
                  (a) => {}
                  
                  // { "before": false, "after": false }
                  (a)=>{}

                  Rule Details

                  This rule takes an object argument with before and after properties, each with a Boolean value.

                  The default configuration is { "before": true, "after": true }.

                  true means there should be one or more spaces and false means no spaces.

                  Examples of incorrect code for this rule with the default { "before": true, "after": true } option:

                  /*eslint arrow-spacing: "error"*/
                  /*eslint-env es6*/
                  
                  ()=> {};
                  () =>{};
                  (a)=> {};
                  (a) =>{};
                  a =>a;
                  a=> a;
                  ()=> {'\n'};
                  () =>{'\n'};

                  Examples of correct code for this rule with the default { "before": true, "after": true } option:

                  /*eslint arrow-spacing: "error"*/
                  /*eslint-env es6*/
                  
                  () => {};
                  (a) => {};
                  a => a;
                  () => {'\n'};

                  Examples of incorrect code for this rule with the { "before": false, "after": false } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
                  /*eslint-env es6*/
                  
                  () =>{};
                  (a) => {};
                  ()=> {'\n'};

                  Examples of correct code for this rule with the { "before": false, "after": false } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
                  /*eslint-env es6*/
                  
                  ()=>{};
                  (a)=>{};
                  ()=>{'\n'};

                  Examples of incorrect code for this rule with the { "before": false, "after": true } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
                  /*eslint-env es6*/
                  
                  () =>{};
                  (a) => {};
                  ()=>{'\n'};

                  Examples of correct code for this rule with the { "before": false, "after": true } option:

                  /*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
                  /*eslint-env es6*/
                  
                  ()=> {};
                  (a)=> {};
                  ()=> {'\n'};

                  Source: http://eslint.org/docs/rules/

                  Trailing spaces not allowed.
                  Open

                  const instances = 3 
                  Severity: Minor
                  Found in ecosystem.config.js by eslint

                  disallow trailing whitespace at the end of lines (no-trailing-spaces)

                  Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before check-in.

                  Rule Details

                  This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines.

                  Examples of incorrect code for this rule:

                  /*eslint no-trailing-spaces: "error"*/
                  
                  var foo = 0;//•••••
                  var baz = 5;//••
                  //•••••

                  Examples of correct code for this rule:

                  /*eslint no-trailing-spaces: "error"*/
                  
                  var foo = 0;
                  var baz = 5;

                  Options

                  This rule has an object option:

                  • "skipBlankLines": false (default) disallows trailing whitespace on empty lines
                  • "skipBlankLines": true allows trailing whitespace on empty lines

                  skipBlankLines

                  Examples of correct code for this rule with the { "skipBlankLines": true } option:

                  /*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/
                  
                  var foo = 0;
                  var baz = 5;
                  //•••••

                  Source: http://eslint.org/docs/rules/

                  Severity
                  Category
                  Status
                  Source
                  Language