Showing 60 of 123 total issues
Function load
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function load() {
return (dispatch, getState) => {
var state = getState().config
if (state.config.length > 0 && state.loaded === false) {
var configUrl = state.config[0]
Function getContent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
getContent(state, actions) {
if (state.search.error === true) {
return (
<div className={ styles.center }>
<br/>
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(){
var app = express()
var theData = {};
Function $
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function $(id) {
if (typeof id !== 'string' || id[0] !== '$') {
return id
} else {
id = id.substr(1)
- 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 loadModuleIfNecessary
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var loadModuleIfNecessary = function(id, cb) {
if (store[id] != null) {
if (store[id].state !== c.LOADING && store[id].state !== c.LOADED && store[id].url != null) {
store[id].state = c.LOADING
store[id].callbacks.push(cb)
- 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 _compilePattern
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function _compilePattern(pattern) {
let regexpSource = ''
const paramNames = []
const tokens = []
- 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 $
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function $(id) {
if (typeof id !== 'string' || id[0] !== '$') {
return id
} else {
id = id.substr(1)
Function end
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
request.end = function(fn) {
if (config.auth === true && state.auth.token != null && state.auth.token !== '' && state.auth.error === false && state.auth.header != null && state.auth.header !== '') {
request = request.set(state.auth.header, state.auth.token)
}
request._end(function(err, res) { // TODO: REFACTOR THIS
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var parse = function(data, packurl) {
var arr = data.split('\n')
var list = []
for (var i in arr) {
var temp = null
- 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 deeply nested control flow statements. Open
if (i === 'en') {
break
}
Avoid deeply nested control flow statements. Open
if (newState.store[ln] == null) {
newState.store[ln] = {}
}
Avoid deeply nested control flow statements. Open
if (id == null) {
console.warn('> Missing id!')
}
Avoid deeply nested control flow statements. Open
if (ln == null) {
console.warn('> Missing language!')
}
Function findModules
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function findModules(obj) {
var arr = []
if (obj.name != null && typeof obj.name === 'string') {
arr.push(obj.name)
if (obj.components != null && typeof obj.components === 'object') {
- 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 deeply nested control flow statements. Open
if (pack[state.languages[i]].complete === true) {
isComplete = true
fallbacks.push(pack[state.languages[i]].url)
break
}
Avoid deeply nested control flow statements. Open
if (i === 'en') {
break
}
Avoid deeply nested control flow statements. Open
if (pack[state.languages[i]].complete === true) {
isComplete = true
break
}
Avoid deeply nested control flow statements. Open
if (i === 'en') {
break
}
Consider simplifying this complex logical expression. Open
if (config.auth === true && state.auth.token != null && state.auth.token !== '' && state.auth.error === false && state.auth.header != null && state.auth.header !== '') {
request = request.set(state.auth.header, state.auth.token)
}
Function matchRoutes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var matchRoutes = function(routes, location) {
for (var i in routes) {
var route = routes[i]
var match = pathMatcher(route.route, location.pathname)
if (match.paramValues != null && match.paramNames != null && match.paramValues.length === match.paramNames.length) {
- 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"