ForestAdmin/forest-express

View on GitHub

Showing 124 of 263 total issues

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

function Checker(opts, Implementation) {
  const { modelsManager } = inject();
  let integrationValid = false;

  function hasIntegration() {
Severity: Minor
Found in src/integrations/close.io/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

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

function Checker(opts, Implementation) {
  const { modelsManager } = inject();
  let integrationValid = false;

  function hasIntegration() {
Severity: Minor
Found in src/integrations/layer/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

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

function Checker(opts, Implementation) {
  const { modelsManager } = inject();
  let integrationValid = false;

  function hasIntegration() {
Severity: Major
Found in src/integrations/close.io/index.js - About 3 hrs to fix

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

    exports.createCollections = (Implementation, apimap, collectionAndFieldName, options) => {
      const { modelsManager } = inject();
      const model = modelsManager.getModels()[collectionAndFieldName.split('.')[0]];
      const modelName = Implementation.getModelName(model);
      const collectionDisplayName = _.capitalize(modelName);
    Severity: Major
    Found in src/integrations/mixpanel/setup.js - About 3 hrs to fix

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

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

        Function Routes has 90 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/layer/routes.js - About 3 hrs to fix

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

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

            Function SmartFieldsValuesInjector has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function SmartFieldsValuesInjector(
              record,
              modelName,
              fieldsPerModel,
              depth = 0,
            Severity: Major
            Found in src/services/smart-fields-values-injector.js - About 3 hrs to fix

              Function serializeSubscriptions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              function serializeSubscriptions(subscriptions, collectionName, meta) {
                function getCustomerAttributes() {
                  if (!subscriptions.length) { return []; }
              
                  const schema = Schemas.schemas[collectionName];
              Severity: Minor
              Found in src/integrations/stripe/serializers/subscriptions.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

              File action-authorization.ts has 309 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                ForestAdminClient,
              } from '@forestadmin/forestadmin-client';
              import hashObject from 'object-hash';
              import BadRequestError from '../../utils/errors/bad-request-error';
              Severity: Minor
              Found in src/services/authorization/action-authorization.ts - About 3 hrs to fix

                Function generateAndSendSchema has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function generateAndSendSchema(envSecret) {
                  const collections = _.values(Schemas.schemas);
                  configStore.integrator.defineCollections(collections);
                
                  collections
                Severity: Major
                Found in src/index.js - About 3 hrs to fix

                  Function errorHandler has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function errorHandler({ logger } = {}) {
                    /**
                     * @param {any} error
                     * @param {import('express').Request} request
                     * @param {import('express').Response} response
                  Severity: Minor
                  Found in src/services/exposed/error-handler.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

                  Function ConversationsGetter has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function ConversationsGetter(Implementation, params, opts, mappingValue) {
                    const Intercom = opts.integrations.intercom.intercom;
                    const intercom = new Intercom.Client(opts.integrations.intercom.credentials);
                  
                    function hasPagination() {
                  Severity: Major
                  Found in src/integrations/intercom/services/conversations-getter.js - About 3 hrs to fix

                    Function SourcesGetter has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function SourcesGetter(Implementation, params, opts, integrationInfo) {
                      const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
                    
                      function hasPagination() {
                        return params.page;
                    Severity: Major
                    Found in src/integrations/stripe/services/sources-getter.js - About 3 hrs to fix

                      Function PaymentsGetter has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function PaymentsGetter(Implementation, params, opts, integrationInfo) {
                        const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
                        let collectionModel = null;
                      
                        function hasPagination() {
                      Severity: Major
                      Found in src/integrations/stripe/services/payments-getter.js - About 3 hrs to fix

                        Function InvoicesGetter has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function InvoicesGetter(Implementation, params, opts, integrationInfo) {
                          const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
                          let collectionModel = null;
                        
                          function hasPagination() {
                        Severity: Major
                        Found in src/integrations/stripe/services/invoices-getter.js - About 3 hrs to fix

                          Function SubscriptionsGetter has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function SubscriptionsGetter(Implementation, params, opts, integrationInfo) {
                            const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
                            let collectionModel = null;
                          
                            function hasPagination() {
                          Severity: Major
                          Found in src/integrations/stripe/services/subscriptions-getter.js - About 3 hrs to fix

                            Function getWithLiveQuery has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              this.getWithLiveQuery = async (request, response, next) => {
                                try {
                                  const { query, contextVariables } = await chartHandler.getQueryForChart({
                                    userId: request.user.id,
                                    renderingId: request.user.renderingId,
                            Severity: Major
                            Found in src/routes/stats.js - About 2 hrs to fix

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

                                this.perform = () => {
                                  if (integrationInfo) {
                                    app.get(
                                      path.generate(`${modelName}_stripe_payments`, opts),
                                      auth.ensureAuthenticated,
                              Severity: Major
                              Found in src/integrations/stripe/routes.js - About 2 hrs to fix

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

                                module.exports = function Routes(app, model, Implementation, options) {
                                  const modelName = Implementation.getModelName(model);
                                  let integrationInfo;
                                
                                  if (options.integrations && options.integrations.intercom) {
                                Severity: Major
                                Found in src/integrations/intercom/routes.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language