grommet/grommet-ferret

View on GitHub
src/js/reducers/notifications.js

Summary

Maintainability
A
3 hrs
Test Coverage

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

  [NOTIFICATIONS_LOAD_SUCCESS]: (state, action) => {
    const result = convertTimestamps(action.result);
    let alert, tasks, busy;
    let preserveUris = state.preserveUris.slice(0);
    result.items.forEach((item) => {
Severity: Minor
Found in src/js/reducers/notifications.js - About 1 hr to fix

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

      [NOTIFICATIONS_LOAD_AGGREGATE_SUCCESS]: (state, action) => {
        // convert to a more useful format
        let status, count;
        action.result.forEach((value) => {
          if ('critical' === value.value.toLowerCase() ||
    Severity: Minor
    Found in src/js/reducers/notifications.js - About 1 hr to fix

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

      export default function notificationsReducer (state = initialState, action) {
        let handler = handlers[action.type];
        if (!handler) return state;
        return { ...state, ...handler(state, action) };
      }
      Severity: Major
      Found in src/js/reducers/notifications.js and 15 other locations - About 1 hr to fix
      src/js/reducers/activity.js on lines 41..45
      src/js/reducers/dashboard.js on lines 31..35
      src/js/reducers/hypervisor.js on lines 46..50
      src/js/reducers/image.js on lines 108..112
      src/js/reducers/index.js on lines 63..67
      src/js/reducers/item.js on lines 50..54
      src/js/reducers/nav.js on lines 74..78
      src/js/reducers/route.js on lines 40..44
      src/js/reducers/search.js on lines 33..37
      src/js/reducers/session.js on lines 73..77
      src/js/reducers/settings.js on lines 62..66
      src/js/reducers/software.js on lines 92..96
      src/js/reducers/status.js on lines 127..131
      src/js/reducers/utilization.js on lines 31..35
      src/js/reducers/vm.js on lines 65..69

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

      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