ForestAdmin/forest-express-sequelize

View on GitHub

Showing 56 of 82 total issues

Function perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  async perform() {
    const { timezone } = this._params;
    const scopeFilters = await scopeManager.getScopeForUser(this._user, this._model.name, true);

    const queryOptions = new QueryOptions(this._model);
Severity: Minor
Found in src/services/resource-updater.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

Avoid deeply nested control flow statements.
Open

        if (conditionValue !== null) {
          condition[field.field] = conditionValue;
          pushCondition(condition, field.field);
        }
Severity: Major
Found in src/services/search-builder.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    if (field.type === 'Number') {
                      const value = parseInt(params.search, 10) || 0;
                      if (value) {
                        condition = opts.Sequelize.where(column, ' = ', value);
                        hasExtendedConditions = true;
    Severity: Major
    Found in src/services/search-builder.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (params.search.match(REGEX_UUID)) {
                  condition[field.field] = params.search;
                  pushCondition(condition, field.field);
                }
      Severity: Major
      Found in src/services/search-builder.js - About 45 mins to fix

        Function ResourcesExporter has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function ResourcesExporter(model, options, params, association, user) {
        Severity: Minor
        Found in src/services/resources-exporter.js - About 35 mins to fix

          Function HasManyDissociator has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function HasManyDissociator(model, association, options, params, data) {
          Severity: Minor
          Found in src/services/has-many-dissociator.js - About 35 mins to fix

            Function HasManyAssociator has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function HasManyAssociator(model, association, opts, params, data) {
            Severity: Minor
            Found in src/services/has-many-associator.js - About 35 mins to fix

              Avoid too many return statements within this function.
              Open

                  return currentPreviousInterval;
              Severity: Major
              Found in src/services/filters-parser.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return [new ApimapFieldTypeDetector({ type: column.type.type }, options).perform()];
                Severity: Major
                Found in src/services/apimap-field-type-detector.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return null;
                  Severity: Major
                  Found in src/services/apimap-field-type-detector.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return 'Time';
                    Severity: Major
                    Found in src/services/apimap-field-type-detector.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return 'Date';
                      Severity: Major
                      Found in src/services/apimap-field-type-detector.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return 'Point';
                        Severity: Major
                        Found in src/services/apimap-field-type-detector.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return 'Number';
                          Severity: Major
                          Found in src/services/apimap-field-type-detector.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return;
                            Severity: Major
                            Found in src/services/search-builder.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return 'Json';
                              Severity: Major
                              Found in src/services/apimap-field-type-detector.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language