ForestAdmin/forest-express

View on GitHub

Showing 124 of 261 total issues

Function Routes has 242 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Routes(app, model, Implementation, opts) {
  const { modelsManager } = inject();
  const modelName = Implementation.getModelName(model);
  let integrationInfo;

Severity: Major
Found in src/integrations/stripe/routes.js - About 1 day to fix

    Function ResourceSerializer has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ResourceSerializer(
      Implementation,
      model,
      records,
      integrator,
    Severity: Major
    Found in src/serializers/resource.js - About 7 hrs to fix

      Function Associations has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function Associations(app, model, Implementation, integrator, opts) {
        const { modelsManager } = inject();
        const modelName = Implementation.getModelName(model);
        const schema = Schemas.schemas[modelName];
      
      
      Severity: Major
      Found in src/routes/associations.js - About 6 hrs to fix

        Function createCollections has 165 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.createCollections = (Implementation, apimap, collectionAndFieldName) => {
          // jshint camelcase: false
          const { modelsManager } = inject();
          const model = modelsManager.getModels()[collectionAndFieldName.split('.')[0]];
          const modelName = Implementation.getModelName(model);
        Severity: Major
        Found in src/integrations/stripe/setup.js - About 6 hrs to fix

          Function perform has 151 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.perform = () => {
              const typeForAttributes = {};
          
              function getAttributesFor(dest, fields) {
                _.map(fields, (field) => {
          Severity: Major
          Found in src/serializers/resource.js - About 6 hrs to fix

            Function Stats has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function Stats(app, model, Implementation, opts) {
              const { chartHandler, modelsManager } = inject();
              const modelName = Implementation.getModelName(model);
              const permissionMiddlewareCreator = new PermissionMiddlewareCreator(modelName);
            
            
            Severity: Minor
            Found in src/routes/stats.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 Stats has 134 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function Stats(app, model, Implementation, opts) {
              const { chartHandler, modelsManager } = inject();
              const modelName = Implementation.getModelName(model);
              const permissionMiddlewareCreator = new PermissionMiddlewareCreator(modelName);
            
            
            Severity: Major
            Found in src/routes/stats.js - About 5 hrs to fix

              Function init has 134 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.init = async (Implementation) => {
                const { opts } = Implementation;
              
                configStore.Implementation = Implementation;
                configStore.lianaOptions = opts;
              Severity: Major
              Found in src/index.js - About 5 hrs to fix

                File index.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const _ = require('lodash');
                const crypto = require('crypto');
                const express = require('express');
                const cors = require('cors');
                const bodyParser = require('body-parser');
                Severity: Minor
                Found in src/index.js - About 5 hrs to fix

                  Function Checker has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function Checker(opts, Implementation) {
                    const { modelsManager } = inject();
                    let integrationValid = false;
                  
                    function upgradeIntegrationInPlace(stripe) {
                  Severity: Minor
                  Found in src/integrations/stripe/index.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 IntercomChecker has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function IntercomChecker(opts, Implementation) {
                    const { modelsManager } = inject();
                    let integrationValid = false;
                  
                    function hasIntegration() {
                  Severity: Minor
                  Found in src/integrations/intercom/index.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 SmartFieldsValuesInjector has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function SmartFieldsValuesInjector(
                    record,
                    modelName,
                    fieldsPerModel,
                    depth = 0,
                  Severity: Minor
                  Found in src/services/smart-fields-values-injector.js - About 4 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 BaseOperatorDateParser has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function BaseOperatorDateParser(options) {
                    const offsetClient = Number.parseInt(moment().tz(options.timezone).format('Z'), 10);
                    const offsetServer = moment().utcOffset() / 60;
                  
                    this.offsetHours = offsetServer - offsetClient;
                  Severity: Major
                  Found in src/services/base-operator-date-parser.js - About 4 hrs to fix

                    Function IntercomChecker has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function IntercomChecker(opts, Implementation) {
                      const { modelsManager } = inject();
                      let integrationValid = false;
                    
                      function hasIntegration() {
                    Severity: Major
                    Found in src/integrations/intercom/index.js - About 4 hrs to fix

                      Function ResourceSerializer has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function ResourceSerializer(
                        Implementation,
                        model,
                        records,
                        integrator,
                      Severity: Minor
                      Found in src/serializers/resource.js - About 4 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 Routes has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function Routes(app, model, Implementation, opts) {
                        const { modelsManager } = inject();
                        const modelName = Implementation.getModelName(model);
                        let integrationInfo;
                      
                      
                      Severity: Major
                      Found in src/integrations/close.io/routes.js - About 4 hrs to fix

                        Function Checker has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function Checker(opts, Implementation) {
                          const { modelsManager } = inject();
                          let integrationValid = false;
                        
                          function upgradeIntegrationInPlace(stripe) {
                        Severity: Major
                        Found in src/integrations/stripe/index.js - About 4 hrs to fix

                          Function init has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                          Open

                          exports.init = async (Implementation) => {
                            const { opts } = Implementation;
                          
                            configStore.Implementation = Implementation;
                            configStore.lianaOptions = opts;
                          Severity: Minor
                          Found in src/index.js - About 4 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 SchemaSerializer has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function SchemaSerializer() {
                            const { apimapSorter } = inject();
                            // WARNING: Attributes declaration order is important for .forestadmin-schema.json format.
                            //          It must be ordered by "importance" to ease the JSON reading for users.
                            const options = {
                          Severity: Major
                          Found in src/serializers/schema.js - About 4 hrs to fix

                            Function Checker has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function Checker(options, Implementation) {
                              const { modelsManager } = inject();
                              let integrationValid = false;
                            
                              function hasIntegration() {
                            Severity: Minor
                            Found in src/integrations/mixpanel/index.js - About 3 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

                            Severity
                            Category
                            Status
                            Source
                            Language