qlik-oss/picasso.js

View on GitHub
plugins/q/src/data/extractor-s.js

Summary

Maintainability
F
4 days
Test Coverage
A
98%

Showing 12 of 12 total issues

Function extract has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

export default function extract(config, dataset, cache, util) {
const cfgs = Array.isArray(config) ? config : [config];
let dataItems = [];
for (let i = 0; i < cfgs.length; i++) {
if (typeof cfgs[i].field !== 'undefined') {
Severity: Minor
Found in plugins/q/src/data/extractor-s.js - About 1 day to fix

Function extract has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function extract(config, dataset, cache, util) {
const cfgs = Array.isArray(config) ? config : [config];
let dataItems = [];
for (let i = 0; i < cfgs.length; i++) {
if (typeof cfgs[i].field !== 'undefined') {
Severity: Major
Found in plugins/q/src/data/extractor-s.js - About 3 hrs to fix

    Function getFieldAccessor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getFieldAccessor(field, page, deps, columnOrder) {
    if (!field) {
    return -1;
    }
    const cache = deps.cache;
    Severity: Minor
    Found in plugins/q/src/data/extractor-s.js - About 2 hrs to fix

    Function getFieldAccessor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getFieldAccessor(field, page, deps, columnOrder) {
    if (!field) {
    return -1;
    }
    const cache = deps.cache;
    Severity: Minor
    Found in plugins/q/src/data/extractor-s.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

      for (let l = 0; l < propsArr.length; l++) {
      const p = props[propsArr[l]];
      let arr = p.fields || [p];
       
      if (p.fields) {
      Severity: Major
      Found in plugins/q/src/data/extractor-s.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

        if (exclude) {
        continue;
        }
        Severity: Major
        Found in plugins/q/src/data/extractor-s.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

          if (track) {
          util.track({
          cfg: cfgs[i],
          itemData: mainCell,
          obj: ret,
          Severity: Major
          Found in plugins/q/src/data/extractor-s.js - About 45 mins to fix

            Function datumExtract has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function datumExtract(propCfg, cell, { key }) {
            const datum = {
            value:
            typeof propCfg.value === 'function'
            ? propCfg.value(cell)
            Severity: Minor
            Found in plugins/q/src/data/extractor-s.js - About 35 mins to fix

            Avoid too many return statements within this function.
            Open

            return (row) => row[fieldIdx];
            Severity: Major
            Found in plugins/q/src/data/extractor-s.js - About 30 mins to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

              function datumExtract(propCfg, cell, { key }) {
              const datum = {
              value:
              typeof propCfg.value === 'function'
              ? propCfg.value(cell)
              Severity: Major
              Found in plugins/q/src/data/extractor-s.js and 1 other location - About 7 hrs to fix
              plugins/q/src/data/extractor-t.js on lines 123..148

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (track) {
              util.track({
              cfg: cfgs[i],
              itemData: mainCell,
              obj: ret,
              Severity: Major
              Found in plugins/q/src/data/extractor-s.js and 1 other location - About 1 hr to fix
              plugins/q/src/data/extractor-t.js on lines 443..452

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              const f = typeof cfgs[i].field === 'object' ? cfgs[i].field : dataset.field(cfgs[i].field);
              Severity: Minor
              Found in plugins/q/src/data/extractor-s.js and 1 other location - About 50 mins to fix
              plugins/q/src/data/extractor-t.js on lines 402..402

              There are no issues that match your filters.

              Category
              Status