mseemann/angular2-mdl

View on GitHub
projects/core/src/lib/ripple/ripple.vendor.ts

Summary

Maintainability
D
1 day
Test Coverage

Function init has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

MaterialRipple.prototype.init = function () {
  if (this.element_) {
    const recentering = this.element_.classList.contains(
      this.CssClasses_.RIPPLE_CENTER
    );
Severity: Minor
Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 4 hrs 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 init has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MaterialRipple.prototype.init = function () {
  if (this.element_) {
    const recentering = this.element_.classList.contains(
      this.CssClasses_.RIPPLE_CENTER
    );
Severity: Major
Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 3 hrs to fix

    Function downHandler_ has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    MaterialRipple.prototype.downHandler_ = function (event) {
      if (!this.rippleElement_.style.width && !this.rippleElement_.style.height) {
        const rect = this.element_.getBoundingClientRect();
        this.boundHeight = rect.height;
        this.boundWidth = rect.width;
    Severity: Minor
    Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 2 hrs 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 downHandler_ has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MaterialRipple.prototype.downHandler_ = function (event) {
      if (!this.rippleElement_.style.width && !this.rippleElement_.style.height) {
        const rect = this.element_.getBoundingClientRect();
        this.boundHeight = rect.height;
        this.boundWidth = rect.width;
    Severity: Minor
    Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 1 hr to fix

      Function setRippleStyles has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            this.setRippleStyles = function (start) {
              if (this.rippleElement_ !== null) {
                let transformString;
                let scale;
                let size;
      Severity: Minor
      Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                    if (recentering) {
                      offset =
                        "translate(" +
                        this.boundWidth / 2 +
                        "px, " +
        Severity: Major
        Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status