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

    getPlayerSigned (hash = false) {
      if (!hash) hash = Object.keys(states).splice(-1)
      return GetState(hash).player
    },
Severity: Major
Found in lib/dapps/DApp.js and 1 other location - About 1 hr to fix
lib/dapps/DApp.js on lines 193..196

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('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 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 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('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('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 false
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

            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

                  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

                  Do not use 'new' for side effects.
                  Open

                        new DCLib.DApp({
                  Severity: Minor
                  Found in lib/dapps/dapps.js by eslint

                  Disallow new For Side Effects (no-new)

                  The goal of using new with a constructor is typically to create an object of a particular type and store that object in a variable, such as:

                  var person = new Person();

                  It's less common to use new and not store the result, such as:

                  new Person();

                  In this case, the created object is thrown away because its reference isn't stored anywhere, and in many cases, this means that the constructor should be replaced with a function that doesn't require new to be used.

                  Rule Details

                  This rule is aimed at maintaining consistency and convention by disallowing constructor calls using the new keyword that do not assign the resulting object to a variable.

                  Examples of incorrect code for this rule:

                  /*eslint no-new: "error"*/
                  
                  new Thing();

                  Examples of correct code for this rule:

                  /*eslint no-new: "error"*/
                  
                  var thing = new Thing();
                  
                  Thing();

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

                  Missing space after =>.
                  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/

                  Unexpected tab character.
                  Open

                      console.log('acc', acc)
                  Severity: Minor
                  Found in test/checks.js by eslint

                  disallow all tabs (no-tabs)

                  Some style guides don't allow the use of tab characters at all, including within comments.

                  Rule Details

                  This rule looks for tabs anywhere inside a file: code, comments or anything else.

                  Examples of incorrect code for this rule:

                  var a /t= 2;
                  
                  /**
                  * /t/t it's a test function
                  */
                  function test(){}
                  
                  var x = 1; // /t test

                  Examples of correct code for this rule:

                  var a = 2;
                  
                  /**
                  * it's a test function
                  */
                  function test(){}
                  
                  var x = 1; // test

                  When Not To Use It

                  If you have established a standard where having tabs is fine.

                  Compatibility

                  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/

                  Severity
                  Category
                  Status
                  Source
                  Language