luyadev/luya

View on GitHub
core/resources/lazyload/intersectionObserver.polyfill.src.js

Summary

Maintainability
F
4 days
Test Coverage

File intersectionObserver.polyfill.src.js has 869 lines of code (exceeds 250 allowed). Consider refactoring.
Open

if (!window.getComputedStyle) {
  /**
   * @param {(Element|null)} e
   * @param {(null|string)=} t
   * @return {(CSSStyleDeclaration|null)}
Severity: Major
Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 2 days to fix

    Function _computeTargetAndRootIntersection has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function(target, targetRect, rootRect) {
          // If the element isn't displayed, an intersection can't happen.
          if (window.getComputedStyle(target).display == 'none') return;
        
          var intersectionRect = targetRect;
    Severity: Major
    Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 2 hrs to fix

      Function _monitorIntersections has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          IntersectionObserver.prototype._monitorIntersections = function(doc) {
            var win = doc.defaultView;
            if (!win) {
              // Already destroyed.
              return;
      Severity: Minor
      Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

        Function getOwnPropertyDescriptor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
                    if (isPrimitive(object)) {
                        throw new TypeError(ERR_NON_OBJECT + object);
                    }
        
        
        Severity: Minor
        Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

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

                  Object.defineProperty = function defineProperty(object, property, descriptor) {
                      if (isPrimitive(object)) {
                          throw new TypeError(ERR_NON_OBJECT_TARGET + object);
                      }
                      if (isPrimitive(descriptor)) {
          Severity: Minor
          Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

            Function _checkForIntersections has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                IntersectionObserver.prototype._checkForIntersections = function() {
                  if (!this.root && crossOriginUpdater && !crossOriginRect) {
                    // Cross origin monitoring, but no initial data available yet.
                    return;
                  }
            Severity: Minor
            Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

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

                  IntersectionObserver.prototype._unmonitorIntersections = function(doc) {
                    var index = this._monitoringDocuments.indexOf(doc);
                    if (index == -1) {
                      return;
                    }
              Severity: Minor
              Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                              if (!crossOriginRect ||
                                  crossOriginRect.width == 0 && crossOriginRect.height == 0) {
                                // A 0-size cross-origin intersection means no-intersection.
                                parent = null;
                                parentRect = null;
                Severity: Major
                Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 45 mins to fix

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

                      function addEvent(node, event, fn, opt_useCapture) {
                        if (typeof node.addEventListener == 'function') {
                          node.addEventListener(event, fn, opt_useCapture || false);
                        }
                        else if (typeof node.attachEvent == 'function') {
                  Severity: Major
                  Found in core/resources/lazyload/intersectionObserver.polyfill.src.js and 1 other location - About 2 hrs to fix
                  core/resources/lazyload/intersectionObserver.polyfill.src.js on lines 1377..1384

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

                  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

                      function removeEvent(node, event, fn, opt_useCapture) {
                        if (typeof node.removeEventListener == 'function') {
                          node.removeEventListener(event, fn, opt_useCapture || false);
                        }
                        else if (typeof node.detatchEvent == 'function') {
                  Severity: Major
                  Found in core/resources/lazyload/intersectionObserver.polyfill.src.js and 1 other location - About 2 hrs to fix
                  core/resources/lazyload/intersectionObserver.polyfill.src.js on lines 1359..1366

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

                  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 (!Object.preventExtensions) {
                          Object.preventExtensions = function preventExtensions(object) {
                              if (Object(object) !== object) {
                                  throw new TypeError('Object.preventExtensions can only be called on Objects.');
                              }
                  core/resources/lazyload/intersectionObserver.polyfill.src.js on lines 478..488

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

                  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 (!Object.seal) {
                          Object.seal = function seal(object) {
                              if (Object(object) !== object) {
                                  throw new TypeError('Object.seal can only be called on Objects.');
                              }
                  core/resources/lazyload/intersectionObserver.polyfill.src.js on lines 521..531

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

                  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 (!Object.isSealed) {
                          Object.isSealed = function isSealed(object) {
                              if (Object(object) !== object) {
                                  throw new TypeError('Object.isSealed can only be called on Objects.');
                              }
                  core/resources/lazyload/intersectionObserver.polyfill.src.js on lines 546..553

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

                  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 (!Object.isFrozen) {
                          Object.isFrozen = function isFrozen(object) {
                              if (Object(object) !== object) {
                                  throw new TypeError('Object.isFrozen can only be called on Objects.');
                              }
                  core/resources/lazyload/intersectionObserver.polyfill.src.js on lines 535..542

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

                  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