AugurProject/augur-ui

View on GitHub
src/modules/notifications/actions/set-notification-text.js

Summary

Maintainability
F
5 days
Test Coverage

Function setNotificationText has 445 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function setNotificationText(notification, callback) {
  return (dispatch, getState) => {
    if (!notification || isEmpty(notification)) {
      return dispatch(callback(notification));
    }
Severity: Major
Found in src/modules/notifications/actions/set-notification-text.js - About 2 days to fix

    File set-notification-text.js has 533 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @todo Update text for FINALIZE once notification triggering is moved
     */
    import { augur } from "services/augurjs";
    import { isEmpty } from "lodash/fp";
    Severity: Major
    Found in src/modules/notifications/actions/set-notification-text.js - About 1 day to fix

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

              if (!notification.description && notification.log) {
                dispatch(
                  loadMarketsInfoIfNotLoaded([notification.log.marketId], () => {
                    const marketInfo = selectMarket(notification.log.marketId);
                    const outcomeDescription = getOutcome(
      Severity: Major
      Found in src/modules/notifications/actions/set-notification-text.js and 1 other location - About 6 hrs to fix
      src/modules/notifications/actions/set-notification-text.js on lines 116..132

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

      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 (!notification.description && notification.log) {
                dispatch(
                  loadMarketsInfoIfNotLoaded([notification.log.marketId], () => {
                    const marketInfo = selectMarket(notification.log.marketId);
                    const outcomeDescription = getOutcome(
      Severity: Major
      Found in src/modules/notifications/actions/set-notification-text.js and 1 other location - About 6 hrs to fix
      src/modules/notifications/actions/set-notification-text.js on lines 136..152

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

      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

            case SENDREPUTATION:
              notification.title = "Send REP";
              if (!notification.description && notification.params) {
                notification.description = `Send ${
                  formatRep(notification.params.reputationToSend).formatted
      Severity: Major
      Found in src/modules/notifications/actions/set-notification-text.js and 1 other location - About 2 hrs to fix
      src/modules/notifications/actions/set-notification-text.js on lines 553..560

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

      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

            case SENDETHER:
              notification.title = "Send ETH";
              if (!notification.description && notification.params) {
                notification.description = `Send ${
                  formatEther(notification.params.etherToSend).formatted
      Severity: Major
      Found in src/modules/notifications/actions/set-notification-text.js and 1 other location - About 2 hrs to fix
      src/modules/notifications/actions/set-notification-text.js on lines 561..568

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

      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

                    notification.description = `Place ${
                      formatRep(
                        createBigNumber(notification.params._amount).dividedBy(
                          TEN_TO_THE_EIGHTEENTH_POWER
                        )
      Severity: Minor
      Found in src/modules/notifications/actions/set-notification-text.js and 1 other location - About 50 mins to fix
      src/modules/notifications/actions/set-notification-text.js on lines 380..386

      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

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

                    notification.description = `Migrate ${
                      formatRep(
                        createBigNumber(notification.log.value).dividedBy(
                          TEN_TO_THE_EIGHTEENTH_POWER
                        )
      Severity: Minor
      Found in src/modules/notifications/actions/set-notification-text.js and 1 other location - About 50 mins to fix
      src/modules/notifications/actions/set-notification-text.js on lines 293..299

      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

      There are no issues that match your filters.

      Category
      Status