Showing 52 of 61 total issues
Function exports
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (service) {
var filters = require('./filters')(service)
return function reductiofy(query) {
var reducer = reductio()
Function universe
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function universe(data, options) {
var service = {
options: _.assign({}, options),
columns: [],
filters: {},
Function reductiofy
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function reductiofy(query) {
var reducer = reductio()
// var groupBy = query.groupBy // groupBy is defined but never used
aggregateOrNest(reducer, query.select)
Function convertAggregatorString
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertAggregatorString(keyString) {
// var obj = {} // obj is defined but not used
// 1. unwrap top parentheses
// 2. detect arrays
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (service) {
return {
make: make,
makeAccessor: makeAccessor,
}
Function buildFilterObject
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildFilterObject(fil, isRange, replace) {
if (_.isUndefined(fil)) {
return false
}
if (_.isFunction(fil)) {
Function ds
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ds = _.map(newFilters, function (fil, i) {
var existing = service.filters[i]
// Filters are the same, so no change is needed on this column
if (fil === existing) {
return Promise.resolve()
Function unwrapParensAndCommas
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function unwrapParensAndCommas(str) {
str = str.replace(' ', '')
return (
'"' +
str.replace(outerParens, function(p, pr) {
Function recurseObject
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function recurseObject(obj, cb) {
_recurseObject(obj, [])
return obj
function _recurseObject(obj, path) {
for (var k in obj) { // eslint-disable-line guard-for-in
- 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 makeSubAggregationFunction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function makeSubAggregationFunction(obj) {
// If its an object, either unwrap all of the properties as an
// array of keyValues, or unwrap the first keyValue set as an object
obj = _.isObject(obj) ? extractKeyValOrArray(obj) : obj
- 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 buildColumnKeys
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildColumnKeys(changes) {
if (column.key === true) {
return Promise.resolve()
}
Function makeSubAggregationFunction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeSubAggregationFunction(obj) {
// If its an object, either unwrap all of the properties as an
// array of keyValues, or unwrap the first keyValue set as an object
obj = _.isObject(obj) ? extractKeyValOrArray(obj) : obj
Function map
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function map(a, b) {
var m
var key
if (isFunction(b)) {
if (isObject(a)) {
Function assign
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function assign(out) {
out = out || {}
for (var i = 1; i < arguments.length; i++) {
if (!arguments[i]) {
continue
- 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 exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (/* service */) {
return {
post: post,
sortByKey: sortByKey,
limit: limit,
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (service) {
return {
make: make,
makeAccessor: makeAccessor,
}
- 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 squash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function squash(query, parent, start, end, aggObj, label) {
Function change
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function change(query, parent, start, end, aggObj) {
Function forEach
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function forEach(a, b) {
if (isObject(a)) {
for (var key in a) {
if (a.hasOwnProperty(key)) {
b(a[key], key, a)
- 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 exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (service) {
return {
build: build,
generateColumns: generateColumns,
add: add,
- 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"