18F/cg-dashboard

View on GitHub
static_src/stores/route_store.js

Summary

Maintainability
C
1 day
Test Coverage

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

  handleAction(action) {
    switch (action.type) {
      case routeActionTypes.ROUTES_RECEIVED: {
        const routes = action.routes;
        this.mergeRoutes(routes);
Severity: Major
Found in static_src/stores/route_store.js - About 6 hrs to fix

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

      handleAction(action) {
        switch (action.type) {
          case routeActionTypes.ROUTES_RECEIVED: {
            const routes = action.routes;
            this.mergeRoutes(routes);
    Severity: Minor
    Found in static_src/stores/route_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 getRouteURLForApp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getRouteURLForApp(app) {
        const allRoutes = this.getAll();
        const boundRoutes = allRoutes.filter(route => route.app_guid === app.guid);
        let url;
        if (boundRoutes.length) {
    Severity: Minor
    Found in static_src/stores/route_store.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

    There are no issues that match your filters.

    Category
    Status