auth0-extensions/auth0-delegated-administration-extension

View on GitHub

Showing 178 of 178 total issues

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

  static propTypes = {
    connections: PropTypes.object.isRequired,
    passwordChange: PropTypes.object.isRequired,
    changePassword: PropTypes.func.isRequired,
    cancelPasswordChange: PropTypes.func.isRequired
Severity: Major
Found in client/containers/Users/Dialogs/PasswordChangeDialog.jsx and 2 other locations - About 1 hr to fix
client/containers/Users/Dialogs/EmailChangeDialog.jsx on lines 29..34
client/containers/Users/Dialogs/UsernameChangeDialog.jsx on lines 27..32

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 58.

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 4 locations. Consider refactoring.
Open

    return request
      .del(`https://${config('AUTH0_DOMAIN')}/api/v2/guardian/enrollments/${enrollmentId}`)
      .set('Authorization', `Bearer ${token}`)
      .set('Content-Type', 'application/json')
      .end((err) => {
Severity: Major
Found in server/lib/removeGuardian.js and 3 other locations - About 1 hr to fix
server/lib/removeGuardian.js on lines 27..38
server/lib/userBlocks.js on lines 8..19
server/lib/userBlocks.js on lines 24..34

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 58.

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 4 locations. Consider refactoring.
Open

    request
      .del(`https://${config('AUTH0_DOMAIN')}/api/v2/user-blocks/${userId}`)
      .set('Authorization', `Bearer ${token}`)
      .set('Content-Type', 'application/json')
      .end((err, res) => {
Severity: Major
Found in server/lib/userBlocks.js and 3 other locations - About 1 hr to fix
server/lib/removeGuardian.js on lines 12..22
server/lib/removeGuardian.js on lines 27..38
server/lib/userBlocks.js on lines 8..19

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 58.

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 3 locations. Consider refactoring.
Open

  static propTypes = {
    cancelEmailChange: PropTypes.func.isRequired,
    changeEmail: PropTypes.func.isRequired,
    connections: PropTypes.object.isRequired,
    emailChange: PropTypes.object.isRequired
Severity: Major
Found in client/containers/Users/Dialogs/EmailChangeDialog.jsx and 2 other locations - About 1 hr to fix
client/containers/Users/Dialogs/PasswordChangeDialog.jsx on lines 32..37
client/containers/Users/Dialogs/UsernameChangeDialog.jsx on lines 27..32

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 58.

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 3 locations. Consider refactoring.
Open

  static propTypes = {
    cancelUsernameChange: PropTypes.func.isRequired,
    changeUsername: PropTypes.func.isRequired,
    connections: PropTypes.object.isRequired,
    usernameChange: PropTypes.object.isRequired
Severity: Major
Found in client/containers/Users/Dialogs/UsernameChangeDialog.jsx and 2 other locations - About 1 hr to fix
client/containers/Users/Dialogs/EmailChangeDialog.jsx on lines 29..34
client/containers/Users/Dialogs/PasswordChangeDialog.jsx on lines 32..37

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 58.

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 4 locations. Consider refactoring.
Open

    request
      .get(`https://${config('AUTH0_DOMAIN')}/api/v2/users/${userId}/enrollments`)
      .set('Authorization', `Bearer ${token}`)
      .set('Content-Type', 'application/json')
      .end((err, res) => {
Severity: Major
Found in server/lib/removeGuardian.js and 3 other locations - About 1 hr to fix
server/lib/removeGuardian.js on lines 12..22
server/lib/userBlocks.js on lines 8..19
server/lib/userBlocks.js on lines 24..34

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 58.

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 4 locations. Consider refactoring.
Open

    request
      .get(`https://${config('AUTH0_DOMAIN')}/api/v2/user-blocks/${userId}`)
      .set('Authorization', `Bearer ${token}`)
      .set('Content-Type', 'application/json')
      .end((err, res) => {
Severity: Major
Found in server/lib/userBlocks.js and 3 other locations - About 1 hr to fix
server/lib/removeGuardian.js on lines 12..22
server/lib/removeGuardian.js on lines 27..38
server/lib/userBlocks.js on lines 24..34

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 58.

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 loadCredentials has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function loadCredentials() {
  return (dispatch) => {
    if (window.location.hash) {
      dispatch({
        type: constants.LOGIN_PENDING
Severity: Minor
Found in client/actions/auth.js - About 1 hr to fix

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

    function getLanguageDictionary(response, onSuccess) {
      const settings = _.get(response, 'data.settings', {});
      let promise = Promise.resolve({ data: {} });
      if (settings.languageDictionary) {
        if (_.isObject(settings.languageDictionary)) {
    Severity: Minor
    Found in client/actions/auth.js - About 1 hr to fix

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

        onSubmit = (changeForm) => {
          const languageDictionary = this.props.languageDictionary.get('record').toJS();
      
          this.props.changePassword(changeForm, languageDictionary);
        };
      Severity: Major
      Found in client/containers/Users/Dialogs/PasswordChangeDialog.jsx and 1 other location - About 1 hr to fix
      client/containers/Users/Dialogs/CreateDialog.jsx on lines 46..49

      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 57.

      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

        onSubmit = (user) => {
          const languageDictionary = this.props.languageDictionary.get('record').toJS();
          this.props.createUser(user, languageDictionary);
        };
      Severity: Major
      Found in client/containers/Users/Dialogs/CreateDialog.jsx and 1 other location - About 1 hr to fix
      client/containers/Users/Dialogs/PasswordChangeDialog.jsx on lines 47..51

      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 57.

      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 parseFieldSection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      const parseFieldSection = (property, sectionInfo, sectionName, inheritedDisplay) => {
        if (sectionInfo && _.isObject(sectionInfo)) {
          const sectionDisplay = parseFunction(property, `${sectionName}.display`, sectionInfo.display);
          const display = sectionDisplay !== undefined ? sectionDisplay : inheritedDisplay;
          if (display !== undefined) sectionInfo.display = display;
      Severity: Minor
      Found in client/reducers/settings.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          const {
            loading,
            error,
            users,
      Severity: Minor
      Found in client/containers/Users/Users.jsx - 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 addExtraUserInfo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const addExtraUserInfo = (token, user) => {
          global.daeUser = global.daeUser || {};
          global.daeUser[user.sub] = global.daeUser[user.sub] || { exp: 0, token: '' };
      
          if (_.isFunction(global.daeUser[user.sub].then)) {
      Severity: Minor
      Found in server/routes/api.js - About 1 hr to fix

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

          render() {
            const { auth, languageDictionary } = this.props;
        
            if (auth.error) {
              return (
        Severity: Minor
        Found in client/containers/Login.jsx - About 1 hr to fix

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

            render() {
              const fields = this.props.customFields || [];
          
              if (fields.length === 0) return null;
          
          
          Severity: Minor
          Found in client/components/Users/UserFieldsChangeForm.jsx - About 1 hr to fix

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

            export function fetchUsers(search, reset = false, page = 0, filterBy, sort, onSuccess) {
              return (dispatch, getState) => {
                const { sortProperty, sortOrder, searchValue, selectedFilter } = getState().users.toJS();
                const meta = { page, sortProperty, sortOrder, searchValue, onSuccess };
                meta.selectedFilter = reset ? '' : filterBy || selectedFilter;
            Severity: Minor
            Found in client/actions/user.js - About 1 hr to fix

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

                  if (!error && this.props.devices.size === 0) {
                    return <div>{languageDictionary.noDevicesMessage || 'This user does not have any registered devices.'}</div>;
                  }
              Severity: Minor
              Found in client/components/Users/UserDevices.jsx and 1 other location - About 55 mins to fix
              client/components/Logs/LogsTable.jsx on lines 28..30

              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 53.

              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

                  if (!error && this.props.logs.size === 0) {
                    return <div>{languageDictionary.noLogsMessage || 'No logs found'}</div>;
                  }
              Severity: Minor
              Found in client/components/Logs/LogsTable.jsx and 1 other location - About 55 mins to fix
              client/components/Users/UserDevices.jsx on lines 39..41

              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 53.

              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 fetchConnections() { // eslint-disable-line import/prefer-default-export
                return {
                  type: constants.FETCH_CONNECTIONS,
                  payload: {
                    promise: axios.get('/api/connections', {
              Severity: Minor
              Found in client/actions/connection.js and 1 other location - About 50 mins to fix
              client/actions/application.js on lines 4..13

              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 52.

              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

              Severity
              Category
              Status
              Source
              Language