auth0-extensions/auth0-delegated-administration-extension

View on GitHub

Showing 178 of 178 total issues

Function getListFields has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  getListFields(props) {
    const { userFields } = props;
    const defaultListFields = [
      {
        listOrder: 0,
Severity: Minor
Found in client/components/Users/UsersTable.jsx - About 2 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 render has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const code = this.state.code;
    const scripts = this.props.scripts.toJS();
    const { languageDictionary, settings } = this.props;
    const originalTitle = (settings.dict && settings.dict.title) || window.config.TITLE || 'User Management';
Severity: Minor
Found in client/containers/Configuration/Configuration.jsx - About 2 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 render has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { loading, sortProperty, sortOrder, error, settings } = this.props;
    const languageDictionary = this.props.languageDictionary || {};
    const labels = languageDictionary.labels || {};
    const searchOptions = this.searchOptions.map((option) => {
Severity: Major
Found in client/components/Users/UserOverview.jsx - About 2 hrs to fix

    Function processTokens has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const processTokens = (dispatch, apiToken, returnTo) => {
      return new Promise((resolve, reject) => {
        // check token expiration date
        const decodedToken = jwtDecode(apiToken);
        if (isTokenExpired(decodedToken)) {
    Severity: Major
    Found in client/actions/auth.js - About 2 hrs to fix

      File UserActions.jsx has 259 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Component } from 'react';
      import PropTypes from 'prop-types';
      import { MenuItem, DropdownButton } from 'react-bootstrap';
      import _ from 'lodash';
      import { removeBlockedIPs } from "../../reducers/removeBlockedIPs";
      Severity: Minor
      Found in client/components/Users/UserActions.jsx - About 2 hrs to fix

        Function getFieldByComponentName has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          getFieldByComponentName(field, componentName) {
            const validate = (field.required || field.validationFunction) ? [] : undefined;
            if (field.required) validate.push(requiredValidationFunction(this.props.languageDictionary || {}));
            if (field.validationFunction) {
              validate.push((value, values, context) => field.validationFunction(value, values, context, this.props.languageDictionary || {}));
        Severity: Minor
        Found in client/components/Users/UserFormField.jsx - About 2 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                <Modal.Header closeButton={!loading} className="has-border" closeLabel={languageDictionary.closeButtonText}>
                  <Modal.Title>{languageDictionary.changeProfileDialogTitle || 'Change Profile'}</Modal.Title>
                </Modal.Header>
        Severity: Major
        Found in client/containers/Users/Dialogs/FieldsChangeDialog.jsx and 1 other location - About 2 hrs to fix
        client/containers/Users/Dialogs/CreateDialog.jsx on lines 59..61

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                <Modal.Header closeButton={!loading} className="has-border" closeLabel={languageDictionary.closeButtonText} >
                  <Modal.Title>{languageDictionary.createDialogTitle || 'Create User'}</Modal.Title>
                </Modal.Header>
        Severity: Major
        Found in client/containers/Users/Dialogs/CreateDialog.jsx and 1 other location - About 2 hrs to fix
        client/containers/Users/Dialogs/FieldsChangeDialog.jsx on lines 56..58

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            } else if (window.config.FEDERATED_LOGOUT) {
              window.location.href = `https://${window.config.AUTH0_CUSTOM_DOMAIN || window.config.AUTH0_DOMAIN}/v2/logout?federated&client_id=${window.config.AUTH0_CLIENT_ID}&returnTo=${encodeURIComponent(window.config.BASE_URL)}`;
            } else {
        Severity: Major
        Found in client/actions/auth.js and 1 other location - About 2 hrs to fix
        client/actions/auth.js on lines 58..60

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 75.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            } else {
              window.location.href = `https://${window.config.AUTH0_CUSTOM_DOMAIN || window.config.AUTH0_DOMAIN}/v2/logout?client_id=${window.config.AUTH0_CLIENT_ID}&returnTo=${encodeURIComponent(window.config.BASE_URL)}`;
            }
        Severity: Major
        Found in client/actions/auth.js and 1 other location - About 2 hrs to fix
        client/actions/auth.js on lines 56..58

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 75.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function checkCustomFieldValidation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const checkCustomFieldValidation = (req, context, isEditRequest, onlyTheseFields) => {
          /* Exit early if no custom fields */
          if (!context.userFields) return context.payload;
        
          const requiredErrorText = (req.query && req.query.requiredErrorText) || 'required';
        Severity: Minor
        Found in server/routes/users.js - About 1 hr to fix

          Function default has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function(client, entity, opts = {}, fetchOptions = {} ) {
            const perPage = fetchOptions.perPage || 50;
            const concurrency = fetchOptions.concurrency || 5;
            const limit = fetchOptions.limit || null;
          
          
          Severity: Minor
          Found in server/lib/multipartRequest.js - About 1 hr to fix

            Function default has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function(client, entity, opts = {}, fetchOptions = {} ) {
              const perPage = fetchOptions.perPage || 50;
              const concurrency = fetchOptions.concurrency || 5;
              const limit = fetchOptions.limit || null;
            
            
            Severity: Minor
            Found in server/lib/multipartRequest.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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export function fetchUserLogs(userId) { // eslint-disable-line import/prefer-default-export
              return {
                type: constants.FETCH_USER_LOGS,
                meta: {
                  userId
            Severity: Major
            Found in client/actions/userLog.js and 1 other location - About 1 hr to fix
            client/actions/userDevice.js on lines 4..16

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 73.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export function fetchUserDevices(userId) { // eslint-disable-line import/prefer-default-export
              return {
                type: constants.FETCH_USER_DEVICES,
                meta: {
                  userId
            Severity: Major
            Found in client/actions/userDevice.js and 1 other location - About 1 hr to fix
            client/actions/userLog.js on lines 4..16

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 73.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function getFieldByComponentName has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getFieldByComponentName(field, componentName) {
                const validate = (field.required || field.validationFunction) ? [] : undefined;
                if (field.required) validate.push(requiredValidationFunction(this.props.languageDictionary || {}));
                if (field.validationFunction) {
                  validate.push((value, values, context) => field.validationFunction(value, values, context, this.props.languageDictionary || {}));
            Severity: Minor
            Found in client/components/Users/UserFormField.jsx - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                [constants.BLOCK_USER_FULFILLED]: (state, action) =>
                  state.updateIn(
                    [ 'records', state.get('records').findIndex(p => p.get('user_id') === action.meta.userId), 'blocked' ], () => true
                  ),
              Severity: Major
              Found in client/reducers/users.js and 1 other location - About 1 hr to fix
              client/reducers/users.js on lines 54..57

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 70.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                [constants.UNBLOCK_USER_FULFILLED]: (state, action) =>
                  state.updateIn(
                    [ 'records', state.get('records').findIndex(p => p.get('user_id') === action.meta.userId), 'blocked' ], () => false
                  ),
              Severity: Major
              Found in client/reducers/users.js and 1 other location - About 1 hr to fix
              client/reducers/users.js on lines 50..53

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 70.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const { error, loading, settings } = this.props;
                  const languageDictionary = this.props.languageDictionary || {};
                  const suppressRawData = settings && settings.suppressRawData === true;
              
              
              Severity: Minor
              Found in client/components/Logs/LogsTable.jsx - About 1 hr to fix

                Function render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const { cancelPasswordChange, settings, connections } = this.props;
                    const { connection, user, error, requesting, loading } = this.props.passwordChange.toJS();
                
                    const userFields = settings.userFields || [];
                Severity: Minor
                Found in client/containers/Users/Dialogs/PasswordChangeDialog.jsx - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language