ICIJ/datashare-client

View on GitHub

Showing 21 of 55 total issues

File search.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  castArray,
  concat,
  cloneDeep,
  each,
Severity: Major
Found in src/store/modules/search.js - About 1 day to fix

    Function actionBuilder has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    function actionBuilder(api) {
      return {
        async get({ commit, state }, idAndRouting) {
          try {
            const { id, index, routing } = idAndRouting
    Severity: Minor
    Found in src/store/modules/document.js - About 7 hrs to fix

    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 actionBuilder has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function actionBuilder(api) {
      return {
        async get({ commit, state }, idAndRouting) {
          try {
            const { id, index, routing } = idAndRouting
    Severity: Major
    Found in src/store/modules/document.js - About 6 hrs to fix

      Function actionsBuilder has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function actionsBuilder(api) {
        return {
          async refresh({ state, commit, getters }, updateIsReady = true) {
            commit('isReady', !updateIsReady)
            commit('error', null)
      Severity: Major
      Found in src/store/modules/search.js - About 5 hrs to fix

        Function actionsBuilder has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

        function actionsBuilder(api) {
          return {
            async refresh({ state, commit, getters }, updateIsReady = true) {
              commit('isReady', !updateIsReady)
              commit('error', null)
        Severity: Minor
        Found in src/store/modules/search.js - About 5 hrs to fix

        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 actionBuilder has 128 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function actionBuilder(api) {
          return {
            clearBatchSearchResults({ commit }) {
              commit(CLEAR_BATCH_SEARCH_RESULTS)
            },
        Severity: Major
        Found in src/store/modules/batchSearch.js - About 5 hrs to fix

          File document.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { compact, concat, findIndex, flattenDeep, get, keys, map, sortBy, sumBy, uniqBy, values } from 'lodash'
          import Vue from 'vue'
          
          import EsDocList from '@/api/resources/EsDocList'
          
          
          Severity: Minor
          Found in src/store/modules/document.js - About 3 hrs to fix

            Function actionsBuilder has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function actionsBuilder(api) {
              return {
                submitExtract({ state }) {
                  if (state.form.path) {
                    return api.indexPath(state.form.path, state.form)
            Severity: Minor
            Found in src/store/modules/indexing.js - About 1 hr to fix

              Function ProjectsMixin has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              const ProjectsMixin = (superclass) =>
                class extends superclass {
                  /**
                   * Call a function when a project is selected
                   * @param {String} name - Name of the project
              Severity: Minor
              Found in src/core/ProjectsMixin.js - About 1 hr to fix

              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 retrieveQueryTerms has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                retrieveQueryTerms(state) {
                  let terms = []
                  function getTerm(query, path, start, operator, isFuzzyNumber = false) {
                    const term = get(query, join([path, 'term'], '.'), '')
                    const field = get(query, join([path, 'field'], '.'), '')
              Severity: Minor
              Found in src/store/modules/search.js - About 1 hr to fix

              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 actionsBuilder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function actionsBuilder(api) {
                return {
                  async starDocuments({ commit }, documents = []) {
                    const starDocs = prepareDocumentIds(documents).map(function ({ index, documentIds }) {
                      return api.starDocuments(index, documentIds)
              Severity: Minor
              Found in src/store/modules/starred.js - About 1 hr to fix

                Function retrieveQueryTerms has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  retrieveQueryTerms(state) {
                    let terms = []
                    function getTerm(query, path, start, operator, isFuzzyNumber = false) {
                      const term = get(query, join([path, 'term'], '.'), '')
                      const field = get(query, join([path, 'field'], '.'), '')
                Severity: Minor
                Found in src/store/modules/search.js - About 1 hr to fix

                  Function actionsBuilder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function actionsBuilder(api) {
                    return {
                      submitExtract({ state }) {
                        if (state.form.path) {
                          return api.indexPath(state.form.path, state.form)
                  Severity: Minor
                  Found in src/store/modules/indexing.js - About 1 hr to fix

                  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 actionBuilder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function actionBuilder(api) {
                    const getIndexStatus = async ({ state }, index) => {
                      try {
                        if (!has(state.allowedFor, index)) {
                          // Not allowed index will throw an error
                  Severity: Minor
                  Found in src/store/modules/downloads.js - About 1 hr to fix

                    Function actionBuilder has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function actionBuilder(api) {
                      return {
                        clearBatchSearchResults({ commit }) {
                          commit(CLEAR_BATCH_SEARCH_RESULTS)
                        },
                    Severity: Minor
                    Found in src/store/modules/batchSearch.js - About 1 hr to fix

                    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 addFilter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      addFilter(body) {
                        if (this.hasValues()) {
                          const filterType = this.isNamedEntityAggregation(body) ? 'Parent' : 'Child'
                          const exclude = this.reverse || this.forceExclude
                          const filterName = exclude ? 'Exclude' : 'Include'
                    Severity: Minor
                    Found in src/store/filters/FilterText.js - About 45 mins to fix

                    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 getTerm has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        function getTerm(query, path, start, operator, isFuzzyNumber = false) {
                    Severity: Minor
                    Found in src/store/modules/search.js - About 35 mins to fix

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

                        getWidgetClass() {
                          return (type) => {
                            // Check if the provided 'type' is a string and exists in the 'widgetTypes' object
                            if (isString(type) && type in widgetTypes) {
                              // Return the corresponding widget class from 'widgetTypes'
                      Severity: Minor
                      Found in src/store/modules/insights.js - About 35 mins to fix

                      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 actionsBuilder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function actionsBuilder(api) {
                        return {
                          async starDocuments({ commit }, documents = []) {
                            const starDocs = prepareDocumentIds(documents).map(function ({ index, documentIds }) {
                              return api.starDocuments(index, documentIds)
                      Severity: Minor
                      Found in src/store/modules/starred.js - About 25 mins to fix

                      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 humanSize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function humanSize(
                        size,
                        showBytes = false,
                        { B = '% B', KB = '% KB', MB = '% MB', GB = '% GB', TB = '% TB' } = {}
                      ) {
                      Severity: Minor
                      Found in src/filters/humanSize.js - About 25 mins to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language