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)
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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))
- Read upRead up
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
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
if (!confirmed) return
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return true
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return false
Trailing spaces not allowed. Open
if (typeof d_conf !== 'object' || d_conf.disable || d_conf.disabled || d_conf.enable === false) return
- Read upRead up
- Exclude checks
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=>{
- Read upRead up
- Exclude checks
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=>{
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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/