auth0-extensions/auth0-source-control-extension-tools

View on GitHub

Showing 36 of 99 total issues

File actions.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable consistent-return */
import _ from 'lodash';
import DefaultHandler, { order } from './default';
import log from '../../logger';
import { areArraysEquals } from '../../utils';
Severity: Minor
Found in src/auth0/handlers/actions.js - About 6 hrs to fix

    Function calcChanges has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    export function calcChanges(assets, existing, identifiers = [ 'id', 'name' ]) {
      // Calculate the changes required between two sets of assets.
      const update = [];
      let del = [ ...existing ];
      let create = [ ...assets ];
    Severity: Minor
    Found in src/utils.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 pagedManager has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    function pagedManager(client, manager) {
      return new Proxy(manager, {
        get: function(target, name, receiver) {
          if (name === 'getAll') {
            return async function(...args) {
    Severity: Minor
    Found in src/auth0/client.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 processChanges has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async processChanges(assets, changes) {
        if (!changes) {
          changes = await this.calcChanges(assets);
        }
    
    
    Severity: Major
    Found in src/auth0/handlers/default.js - About 3 hrs to fix

      Function calcChanges has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function calcChanges(assets, existing, identifiers = [ 'id', 'name' ]) {
        // Calculate the changes required between two sets of assets.
        const update = [];
        let del = [ ...existing ];
        let create = [ ...assets ];
      Severity: Major
      Found in src/utils.js - About 2 hrs to fix

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

        function pagedManager(client, manager) {
          return new Proxy(manager, {
            get: function(target, name, receiver) {
              if (name === 'getAll') {
                return async function(...args) {
        Severity: Minor
        Found in src/auth0/client.js - About 1 hr to fix

          Function get has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              get: function(target, name, receiver) {
                if (name === 'getAll') {
                  return async function(...args) {
                    // If the function was called with object params and paginate (entity) then handle pagination
                    if (args[0] && typeof args[0] === 'object' && args[0].paginate) {
          Severity: Minor
          Found in src/auth0/client.js - About 1 hr to fix

            Function getType has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async getType() {
                if (this.existing) {
                  return this.existing;
                }
            
            
            Severity: Minor
            Found in src/auth0/handlers/triggers.js - About 1 hr to fix

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

                async calcChanges(actionsAssets, existing) {
                  // Calculate the changes required between two sets of assets.
                  const update = [];
                  let del = [ ...existing ];
                  const create = [];
              Severity: Minor
              Found in src/auth0/handlers/actions.js - About 1 hr to fix

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

                  @order('70')
                  async processChanges(assets) {
                    const { organizations } = assets;
                    // Do nothing if not set
                    if (!organizations) return;
                Severity: Minor
                Found in src/auth0/handlers/organizations.js - About 1 hr to fix

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

                    async calcChanges(assets, includeExcluded = false) {
                      let { rules } = assets;
                  
                      const excludedRules = (assets.exclude && assets.exclude.rules) || [];
                  
                  
                  Severity: Minor
                  Found in src/auth0/handlers/rules.js - About 1 hr to fix

                    Function processChanges has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      @order('60')
                      async processChanges(assets) {
                        const { clientGrants } = assets;
                    
                        // Do nothing if not set
                    Severity: Minor
                    Found in src/auth0/handlers/clientGrants.js - About 1 hr to fix

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

                        @order('60')
                        async processChanges(assets) {
                          // eslint-disable-next-line prefer-destructuring
                          const actions = assets.actions;
                      
                      
                      Severity: Minor
                      Found in src/auth0/handlers/actions.js - About 1 hr to fix

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

                          async processChanges(assets) {
                            const { emailProvider } = assets;
                        
                            // Do nothing if not set
                            if (!emailProvider) return;
                        Severity: Minor
                        Found in src/auth0/handlers/emailProvider.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 getType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async getType() {
                            if (this.existing) {
                              return this.existing;
                            }
                        
                        
                        Severity: Minor
                        Found in src/auth0/handlers/actions.js - About 1 hr to fix

                          Function updateOrganization has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async updateOrganization(org, organizations) {
                              const { connections: existingConnections } = await organizations.find((orgToUpdate) => orgToUpdate.name === org.name);
                          
                              const params = { id: org.id };
                              const { connections } = org;
                          Severity: Minor
                          Found in src/auth0/handlers/organizations.js - About 1 hr to fix

                            Function getType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async getType() {
                                if (this.existing) {
                                  return this.existing;
                                }
                            
                            
                            Severity: Minor
                            Found in src/auth0/handlers/triggers.js - About 55 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 processChanges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              @order('60')
                              async processChanges(assets) {
                                const { clientGrants } = assets;
                            
                                // Do nothing if not set
                            Severity: Minor
                            Found in src/auth0/handlers/clientGrants.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 getVersionById has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async getVersionById(actionId, deployedVersion) {
                                // in case client version does not support actionVersions
                                if (typeof this.client.actions.getVersions !== 'function') {
                                  return null;
                                }
                            Severity: Minor
                            Found in src/auth0/handlers/actions.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 calcDeployedVersionChanges has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async calcDeployedVersionChanges(actionId, actionAsset, existingVersion) {
                                const create = [];
                            
                                if (actionAsset.deployed) {
                                  const versionToCreate = {
                            Severity: Minor
                            Found in src/auth0/handlers/actions.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

                            Severity
                            Category
                            Status
                            Source
                            Language