ethereum/mist

View on GitHub
modules/preloader/injected/EventEmitter3.js

Summary

Maintainability
D
2 days
Test Coverage

Function emit has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
    var evt = prefix ? prefix + event : event;

    if (!this._events[evt]) return false;

Severity: Major
Found in modules/preloader/injected/EventEmitter3.js - About 2 hrs to fix

    Function removeListener has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      EventEmitter.prototype.removeListener = function removeListener(
        event,
        fn,
        context,
        once
    Severity: Minor
    Found in modules/preloader/injected/EventEmitter3.js - About 1 hr to fix

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

        EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
      Severity: Minor
      Found in modules/preloader/injected/EventEmitter3.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      for (j = 1, args = new Array(len - 1); j < len; j++) {
                        args[j - 1] = arguments[j];
                      }
        Severity: Major
        Found in modules/preloader/injected/EventEmitter3.js - About 45 mins to fix

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

              if (!this._events[evt]) (this._events[evt] = listener), this._eventsCount++;
              else if (!this._events[evt].fn) this._events[evt].push(listener);
              else this._events[evt] = [this._events[evt], listener];
          Severity: Major
          Found in modules/preloader/injected/EventEmitter3.js and 1 other location - About 3 hrs to fix
          modules/preloader/injected/EventEmitter3.js on lines 217..219

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

          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 (!this._events[evt]) (this._events[evt] = listener), this._eventsCount++;
              else if (!this._events[evt].fn) this._events[evt].push(listener);
              else this._events[evt] = [this._events[evt], listener];
          Severity: Major
          Found in modules/preloader/injected/EventEmitter3.js and 1 other location - About 3 hrs to fix
          modules/preloader/injected/EventEmitter3.js on lines 197..199

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

          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

                        for (j = 1, args = new Array(len - 1); j < len; j++) {
                          args[j - 1] = arguments[j];
                        }
          Severity: Major
          Found in modules/preloader/injected/EventEmitter3.js and 1 other location - About 1 hr to fix
          modules/preloader/injected/EventEmitter3.js on lines 144..146

          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

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

                for (i = 1, args = new Array(len - 1); i < len; i++) {
                  args[i - 1] = arguments[i];
                }
          Severity: Major
          Found in modules/preloader/injected/EventEmitter3.js and 1 other location - About 1 hr to fix
          modules/preloader/injected/EventEmitter3.js on lines 172..174

          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

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

                if (
                  listeners.fn === fn &&
                  (!once || listeners.once) &&
                  (!context || listeners.context === context)
                ) {
          Severity: Minor
          Found in modules/preloader/injected/EventEmitter3.js and 1 other location - About 50 mins to fix
          modules/preloader/injected/EventEmitter3.js on lines 297..300

          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

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

                if (this._events[evt]) {
                  if (--this._eventsCount === 0) this._events = new Events();
                  else delete this._events[evt];
                }
          Severity: Minor
          Found in modules/preloader/injected/EventEmitter3.js and 1 other location - About 50 mins to fix
          modules/preloader/injected/EventEmitter3.js on lines 252..259

          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