Function doIt
has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
function doIt({ propsArr, props, item, itemData, ret, sourceKey }) {
for (let i = 0; i < propsArr.length; i++) {
const pCfg = props[propsArr[i]];
const arr = pCfg.fields || [pCfg];
let coll;
File extractor-t.js
has 403 lines of code (exceeds 250 allowed). Consider refactoring.
import { hierarchy, stratify } from 'd3-hierarchy';
import picker from '../json-path-resolver';
Function extract
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
export function extract(config, dataset, cache, util) {
const cfgs = Array.isArray(config) ? config : [config];
let dataItems = [];
for (let g = 0; g < cfgs.length; g++) {
if (typeof cfgs[g].field !== 'undefined') {
Function getFieldDepth
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
export function getFieldDepth(field, { cube }) {
if (!field) {
return -1;
}
Function extract
has 68 lines of code (exceeds 25 allowed). Consider refactoring.
export function extract(config, dataset, cache, util) {
const cfgs = Array.isArray(config) ? config : [config];
let dataItems = [];
for (let g = 0; g < cfgs.length; g++) {
if (typeof cfgs[g].field !== 'undefined') {
Function augment
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
export function augment(config = {}, dataset, cache, util) {
const cube = dataset.raw();
const sourceKey = dataset.key();
const h = cube.qMode === 'S' ? getHierarchyForSMode(dataset) : getHierarchy(cube, cache, config);
if (!h) {
Function augment
has 58 lines of code (exceeds 25 allowed). Consider refactoring.
export function augment(config = {}, dataset, cache, util) {
const cube = dataset.raw();
const sourceKey = dataset.key();
const h = cube.qMode === 'S' ? getHierarchyForSMode(dataset) : getHierarchy(cube, cache, config);
if (!h) {
Function getHierarchyForSMode
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
function getHierarchyForSMode(dataset) {
const matrix = dataset.raw().qDataPages.length ? dataset.raw().qDataPages[0].qMatrix : [];
const order = getColumnOrder(dataset);
const fields = dataset.fields();
const dimensions = dataset
Function getHierarchyForSMode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
function getHierarchyForSMode(dataset) {
const matrix = dataset.raw().qDataPages.length ? dataset.raw().qDataPages[0].qMatrix : [];
const order = getColumnOrder(dataset);
const fields = dataset.fields();
const dimensions = dataset
Avoid deeply nested control flow statements.
if (Array.isArray(nodes)) {
cells = nodes.map(p.valueAccessor);
if (p.attrAccessor) {
cells = cells.map(p.attrAccessor);
Function attachPropsAccessors
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
const attachPropsAccessors = ({ propsArr, props, cube, cache, itemDepthObject, f }) => {
for (let i = 0; i < propsArr.length; i++) {
const pCfg = props[propsArr[i]];
const arr = pCfg.fields ? pCfg.fields : [pCfg];
for (let j = 0; j < arr.length; j++) {
Function datumExtract
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
function datumExtract(propCfg, cell, { key }) {
const datum = {
value:
typeof propCfg.value === 'function'
? propCfg.value(cell)
Identical blocks of code found in 2 locations. Consider refactoring.
function datumExtract(propCfg, cell, { key }) {
const datum = {
value:
typeof propCfg.value === 'function'
? propCfg.value(cell)
Similar blocks of code found in 2 locations. Consider refactoring.
const measures = dataset
.fields()
.filter((f) => f.type() === 'measure')
.map((f) => order.indexOf(fields.indexOf(f)));
Similar blocks of code found in 2 locations. Consider refactoring.
const dimensions = dataset
.fields()
.filter((f) => f.type() === 'dimension')
.map((f) => order.indexOf(fields.indexOf(f)));
Similar blocks of code found in 2 locations. Consider refactoring.
if (track) {
util.track({
cfg: cfgs[g],
itemData,
obj: ret,
Similar blocks of code found in 2 locations. Consider refactoring.
const f = typeof cfgs[g].field === 'object' ? cfgs[g].field : dataset.field(cfgs[g].field);
There are no issues that match your filters.