auth0-extensions/auth0-delegated-administration-extension

View on GitHub
client/actions/user.js

Summary

Maintainability
F
3 days
Test Coverage

File user.js has 450 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import axios from 'axios';
import { push } from 'react-router-redux';

import * as constants from '../constants';
import { fetchUserLogs } from './userLog';
Severity: Minor
Found in client/actions/user.js - About 6 hrs 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

      Function fetchUsers has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      export function fetchUsers(search, reset = false, page = 0, filterBy, sort, onSuccess) {
      Severity: Minor
      Found in client/actions/user.js - About 45 mins to fix

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

        export function unblockUser() {
          return (dispatch, getState) => {
            const userId = getState().unblock.get('user').get('user_id');
            dispatch({
              type: constants.UNBLOCK_USER,
        Severity: Major
        Found in client/actions/user.js and 2 other locations - About 4 hrs to fix
        client/actions/user.js on lines 265..281
        client/actions/user.js on lines 345..361

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

        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

        export function removeUserBlocks() {
          return (dispatch, getState) => {
            const userId = getState().removeBlockedIPs.get('user').get('user_id');
            dispatch({
              type: constants.REMOVE_BLOCKED_IPS,
        Severity: Major
        Found in client/actions/user.js and 2 other locations - About 4 hrs to fix
        client/actions/user.js on lines 265..281
        client/actions/user.js on lines 324..340

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

        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

        export function blockUser() {
          return (dispatch, getState) => {
            const userId = getState().block.get('user').get('user_id');
            dispatch({
              type: constants.BLOCK_USER,
        Severity: Major
        Found in client/actions/user.js and 2 other locations - About 4 hrs to fix
        client/actions/user.js on lines 324..340
        client/actions/user.js on lines 345..361

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

        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

            dispatch({
              type: constants.EMAIL_CHANGE,
              meta: {
                user,
                onSuccess: () => {
        Severity: Major
        Found in client/actions/user.js and 1 other location - About 2 hrs to fix
        client/actions/user.js on lines 515..527

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

        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

            dispatch({
              type: constants.USERNAME_CHANGE,
              meta: {
                user,
                onSuccess: () => {
        Severity: Major
        Found in client/actions/user.js and 1 other location - About 2 hrs to fix
        client/actions/user.js on lines 559..571

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

        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 requestUsernameChange(user, connection, customField) {
          return {
            type: constants.REQUEST_USERNAME_CHANGE,
            user,
            connection,
        Severity: Minor
        Found in client/actions/user.js and 1 other location - About 35 mins to fix
        client/actions/user.js on lines 534..541

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

        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 requestEmailChange(user, connection, customField) {
          return {
            type: constants.REQUEST_EMAIL_CHANGE,
            user,
            connection,
        Severity: Minor
        Found in client/actions/user.js and 1 other location - About 35 mins to fix
        client/actions/user.js on lines 490..497

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

        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

        There are no issues that match your filters.

        Category
        Status