ForestAdmin/forest-express

View on GitHub

Showing 124 of 263 total issues

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

function serializePayments(payments, collectionName, meta) {
  function getCustomerAttributes() {
    if (!payments.length) { return []; }

    const schema = Schemas.schemas[collectionName];
Severity: Minor
Found in src/integrations/stripe/serializers/payments.js - About 1 hr to fix

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

      function setSmartFieldValue(record, field, modelName) {
        if (field.value) {
          logger.warn(`DEPRECATION WARNING: Smart Fields "value" method is deprecated. Please use "get" method in your collection ${modelName} instead.`);
        }
    
    
    Severity: Minor
    Found in src/services/smart-fields-values-injector.js - About 1 hr to fix

      Function extractAttributes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function extractAttributes() {
          let { attributes } = params.data;
          if (params.data.attributes) {
            attributes[schema.idField] = params.data.attributes[schema.idField]
              || params.data.id;
      Severity: Minor
      Found in src/deserializers/resource.js - About 1 hr to fix

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

          this.perform = () => {
            const collectionFieldName = integrationInfo.field;
            const collectionModel = integrationInfo.collection;
        
            return Implementation.Mixpanel.getUser(collectionModel, params.recordId)
        Severity: Minor
        Found in src/integrations/mixpanel/services/mixpanel-events-getter.js - About 1 hr to fix

          Function serializeMixpanelEvents has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function serializeMixpanelEvents(events, collectionName, meta, options) {
            events = events.map((event) => {
              const MAP_PROPERTIES = {
                $city: 'city',
                $region: 'region',
          Severity: Minor
          Found in src/integrations/mixpanel/serializers/mixpanel-events.js - About 1 hr to fix

            Function AttributesGetter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function AttributesGetter(Implementation, params, opts, mappingValue) {
              const Intercom = opts.integrations.intercom.intercom;
              const intercom = new Intercom.Client(opts.integrations.intercom.credentials);
            
              this.perform = async () => {
            Severity: Minor
            Found in src/integrations/intercom/services/attributes-getter.js - About 1 hr to fix

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

                static validateLayoutElement(element) {
                  if (!validLayoutComponents.includes(element.component)) throw new Error(`${element.component} is not a valid component. Valid components are ${validLayoutComponents.join(' or ')}`);
                  if (element.component === 'Page') {
                    if (!Array.isArray(element.elements)) {
                      throw new Error('Page components must contain an array of fields or layout elements in property \'elements\'');
              Severity: Minor
              Found in src/services/smart-action-form-layout-service.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 generateAndSendSchema has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              async function generateAndSendSchema(envSecret) {
                const collections = _.values(Schemas.schemas);
                configStore.integrator.defineCollections(collections);
              
                collections
              Severity: Minor
              Found in src/index.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 parseCondition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              const parseCondition = async (condition, formatCondition, modelSchema) => {
                if (_.isEmpty(condition)) { throw new InvalidFiltersFormat('Empty condition in filter'); }
                if (!_.isObject(condition)) { throw new InvalidFiltersFormat('Condition cannot be a raw value'); }
                if (_.isArray(condition)) { throw new InvalidFiltersFormat('Filters cannot be a raw array'); }
                if (!_.isString(condition.field) || !_.isString(condition.operator)
              Severity: Minor
              Found in src/services/base-filters-parser.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 cleanActions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                cleanActions(actions) {
                  actions = actions.filter((action) => action.name);
                  actions.forEach((action) => {
                    if (action.global) {
                      this.logger.warn(`REMOVED OPTION: The support for Smart Action "global" option is now removed. Please set "type: 'global'" instead of "global: true" for the "${action.name}" Smart Action.`);
              Severity: Minor
              Found in src/services/schema-file-updater.js - About 1 hr to fix

                Function InvoicesGetter has 29 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 getInvoice(invoiceId) {
                Severity: Minor
                Found in src/integrations/stripe/services/invoice-getter.js - About 1 hr to fix

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

                  function ConversationsGetter(Implementation, params, opts, integrationInfo) {
                    let collectionModel = null;
                  
                    function getConversations(user) {
                      return new P(((resolve, reject) => {
                  Severity: Minor
                  Found in src/integrations/layer/services/conversations-getter.js - About 1 hr to fix

                    Function PaymentsGetter has 29 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 getCharge(paymentId) {
                    Severity: Minor
                    Found in src/integrations/stripe/services/payment-getter.js - About 1 hr to fix

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

                        this.perform = async () => {
                          try {
                            const contactQueryResponse = await ContactGetter
                              .getContact(intercom, Implementation, mappingValue, params.recordId);
                      
                      
                      Severity: Minor
                      Found in src/integrations/intercom/services/attributes-getter.js - About 1 hr to fix

                        Function cleanFields has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          static cleanFields(fields) {
                            fields = fields.filter((field) => field.field);
                            fields.forEach((field) => {
                              if (field.defaultValue === undefined) {
                                field.defaultValue = null;
                        Severity: Minor
                        Found in src/services/schema-file-updater.js - About 1 hr to fix

                          Function SubscriptionGetter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function SubscriptionGetter(Implementation, params, opts, integrationInfo) {
                            const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
                          
                            function getSubscription(subscriptionId) {
                              return new P((resolve, reject) => {
                          Severity: Minor
                          Found in src/integrations/stripe/services/subscription-getter.js - About 1 hr to fix

                            Function Associations has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                            Found in src/routes/associations.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 ResourceDeserializer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function ResourceDeserializer(Implementation, model, params, withRelationships, opts) {
                              if (!opts) { opts = {}; }
                              const schema = Schemas.schemas[Implementation.getModelName(model)];
                            
                              function extractAttributes() {
                            Severity: Minor
                            Found in src/deserializers/resource.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 SourcesGetter has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                            Found in src/integrations/stripe/services/sources-getter.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 InvoicesGetter has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                            Found in src/integrations/stripe/services/invoices-getter.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

                            Severity
                            Category
                            Status
                            Source
                            Language