Showing 10 of 19 total issues
Function parseState
has 402 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseState(data){
/**
* [addStateLinks add states_to property to the given state object. After running this function, state.states_to contains state exits]
* @param {[type]} state [state]
* @param {[type]} properties [array of properties, containing the state numbers to go, e.g. ['500', '004']]
File states.js
has 647 lines of code (exceeds 250 allowed). Consider refactoring. Open
const LevelsService = require('atm-state-levels');
const semver = require('semver');
const pkgjson = require('../package.json');
Function check_version
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
check_version(){
if(this.settings){
let settings_version = this.settings.get('states_version');
try {
if(settings_version && !semver.lt(settings_version, this.pkg_version)){
- 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
Function add
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
add(data){
let result = true;
if(typeof data === 'object') {
for (let i = 0; i < data.length; i++){
- 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
Function parseState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
parseState(data){
/**
* [addStateLinks add states_to property to the given state object. After running this function, state.states_to contains state exits]
* @param {[type]} state [state]
* @param {[type]} properties [array of properties, containing the state numbers to go, e.g. ['500', '004']]
- 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
Function addStateArray
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
addStateArray(state_array){
let state_string = '';
let valid = true;
state_array.forEach(entry => {
Function convertMapToObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
convertMapToObject(map_state){
let object_state = {};
for(let [key, value] of map_state)
if(value instanceof Set){
// Converting Set to Array
- 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
Function convertObjectToMap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
convertObjectToMap(object_state){
let map_state = new Map();
for(let key in object_state)
if(key === 'states_to'){
let states_to = new Set();
- 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
Function getNodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getNodes(){
let nodes = [];
this.updateStateLevels();
- 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
Function getEdges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getEdges(){
let edges = [];
for (let i in this.states){
let state = this.states[i];
- 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"