18F/cg-dashboard

View on GitHub
static_src/stores/user_store.js

Summary

Maintainability
D
2 days
Test Coverage

Function handleAction has 242 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  handleAction(action) {
    switch (action.type) {
      case userActionTypes.ORG_USERS_FETCH: {
        this.loadingRequests.entityUsers = true;
        break;
Severity: Major
Found in static_src/stores/user_store.js - About 1 day to fix

    File user_store.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Store for user data. Will store and update user data on changes from UI and
     * server.
     */
    
    
    Severity: Minor
    Found in static_src/stores/user_store.js - About 5 hrs to fix

      Function addUserRole has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        addUserRole(user, entityType, entityGuid, addedRole, cb) {
          const updatedUser = user;
          if (updatedUser) {
            if (entityType === "space") {
              if (!updatedUser.space_roles) updatedUser.space_roles = {};
      Severity: Minor
      Found in static_src/stores/user_store.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 handleAction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        handleAction(action) {
          switch (action.type) {
            case userActionTypes.ORG_USERS_FETCH: {
              this.loadingRequests.entityUsers = true;
              break;
      Severity: Minor
      Found in static_src/stores/user_store.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 deleteUserRole has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        deleteUserRole(user, entityType, entityGuid, deletedRole, cb) {
          const updatedUser = user;
          if (updatedUser) {
            let roles;
            if (entityType === "space") {
      Severity: Minor
      Found in static_src/stores/user_store.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

      There are no issues that match your filters.

      Category
      Status