Function qBrush
has 196 lines of code (exceeds 25 allowed). Consider refactoring.
export default function qBrush(brush, opts = {}, layout) {
const byCells = opts.byCells;
const primarySource = opts.primarySource;
const selections = [];
const methods = {};
File q-brush.js
has 283 lines of code (exceeds 250 allowed). Consider refactoring.
import resolve from '../json-path-resolver';
const LAYOUT_TO_PROP = [
['qHyperCube', 'qHyperCubeDef'],
['qTreeData', 'qTreeDataDef'],
Function extractFieldFromId
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
export function extractFieldFromId(id, layout) {
let path = id;
let dimensionIdx = -1;
let measureIdx = -1;
let pathToCube = '';
Function extractFieldFromId
has 66 lines of code (exceeds 25 allowed). Consider refactoring.
export function extractFieldFromId(id, layout) {
let path = id;
let dimensionIdx = -1;
let measureIdx = -1;
let pathToCube = '';
Avoid deeply nested control flow statements.
if (!methods.selectHyperCubeCells) {
methods.selectHyperCubeCells = {
path: info.path,
cols: [],
};
Avoid deeply nested control flow statements.
if (b.id === primarySource || !primarySource) {
const validValues = b.brush
.values()
.map((s) => +s)
.filter((v) => !isNaN(v));
Avoid deeply nested control flow statements.
if (b.id === primarySource || (!primarySource && !methods.selectHyperCubeCells.values)) {
methods.selectHyperCubeCells.values = b.brush
.values()
.map((s) => +s)
.filter((v) => !isNaN(v));
Avoid deeply nested control flow statements.
if (!methods.selectPivotCells) {
methods.selectPivotCells = {
path: info.path,
cells: [],
};
Function qBrush
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
export default function qBrush(brush, opts = {}, layout) {
const byCells = opts.byCells;
const primarySource = opts.primarySource;
const selections = [];
const methods = {};
Similar blocks of code found in 2 locations. Consider refactoring.
if (b.type === 'range' && info.measureIdx > -1) {
const ranges = b.brush.ranges();
if (ranges.length) {
hasValues = true;
if (!methods.rangeSelectHyperCubeValues) {
Similar blocks of code found in 2 locations. Consider refactoring.
if (b.type === 'range' && info.dimensionIdx > -1) {
const ranges = b.brush.ranges();
if (ranges.length) {
hasValues = true;
if (!methods.selectHyperCubeContinuousRange) {
Similar blocks of code found in 3 locations. Consider refactoring.
if (methods.selectHyperCubeContinuousRange) {
selections.push({
method: 'selectHyperCubeContinuousRange',
params: [methods.selectHyperCubeContinuousRange.path, methods.selectHyperCubeContinuousRange.ranges],
});
Similar blocks of code found in 3 locations. Consider refactoring.
if (methods.selectPivotCells) {
selections.push({
method: 'selectPivotCells',
params: [methods.selectPivotCells.path, methods.selectPivotCells.cells],
});
Similar blocks of code found in 3 locations. Consider refactoring.
if (methods.multiRangeSelectTreeDataValues) {
selections.push({
method: 'multiRangeSelectTreeDataValues',
params: [methods.multiRangeSelectTreeDataValues.path, methods.multiRangeSelectTreeDataValues.ranges],
});
Similar blocks of code found in 2 locations. Consider refactoring.
} else if (TD_RX.test(id)) {
pathToCube = `${path.substr(0, path.indexOf('qTreeData') + 9)}`;
shortenizer = SHORTEN_TD;
}
Similar blocks of code found in 2 locations. Consider refactoring.
if (HC_RX.test(id)) {
pathToCube = `${path.substr(0, path.indexOf('qHyperCube') + 10)}`;
shortenizer = SHORTEN_HC;
} else if (TD_RX.test(id)) {
pathToCube = `${path.substr(0, path.indexOf('qTreeData') + 9)}`;
Similar blocks of code found in 2 locations. Consider refactoring.
const validValues = b.brush
.values()
.map((s) => +s)
.filter((v) => !isNaN(v));
Similar blocks of code found in 2 locations. Consider refactoring.
const values = b.brush
.values()
.map((s) => +s)
.filter((v) => !isNaN(v));
Similar blocks of code found in 2 locations. Consider refactoring.
measureIdx = hc.qMeasureInfo.slice(0, offset).reduce((v, meas) => v + meas.qAttrExprInfo.length, measureIdx);
Similar blocks of code found in 2 locations. Consider refactoring.
measureIdx = hc.qDimensionInfo
.slice(0, dimensionIdx)
.reduce((v, dim) => v + dim.qAttrExprInfo.length, measureIdx);
There are no issues that match your filters.