auth0-extensions/auth0-delegated-administration-extension

View on GitHub

Showing 66 of 178 total issues

Function requestGuardianEnrollments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const requestGuardianEnrollments = (token, userId) =>
  new Promise((resolve, reject) => {
    request
      .get(`https://${config('AUTH0_DOMAIN')}/api/v2/users/${userId}/enrollments`)
      .set('Authorization', `Bearer ${token}`)
Severity: Minor
Found in server/lib/removeGuardian.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

Function getDisplayObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  static getDisplayObject(user, fields) {
    if (fields.length > 0) {
      let displayFunction = undefined;
      if (_.isFunction(fields[0].edit.display)) displayFunction = fields[0].edit.display;
      else if (!fields[0].edit.display && fields[0].edit.display !== false && _.isFunction(fields[0].display)) displayFunction = fields[0].display;
Severity: Minor
Found in client/components/Users/UserActions.jsx - 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

Avoid too many return statements within this function.
Open

  return value;
Severity: Major
Found in client/utils/display.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return (this.getFieldComponent(field, InputText, additionalOptions));
    Severity: Major
    Found in client/components/Users/UserFormField.jsx - About 30 mins to fix

      Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          const { user, databaseConnections, log, logs, devices, settings, languageDictionary } = this.props;
          const userFields = (settings && settings.userFields) || [];
          const allowedUserFields = userFields.filter(field => field.property !== 'picture' && field.property !== 'client');
          const suppressRawData = settings && settings.suppressRawData === true;
      Severity: Minor
      Found in client/containers/Users/User.jsx - About 25 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 checkRole has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const checkRole = (data) => {
        let accessLevel = -1;
        if (!data) return accessLevel;
      
        const parsedData = (Array.isArray(data)) ? data : data.replace(', ', ',', 'g').split(',');
      Severity: Minor
      Found in server/lib/getScopes.js - About 25 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