betajs/betajs-browser

View on GitHub
src/dom/dom.js

Summary

Maintainability
D
2 days
Test Coverage

File dom.js has 597 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:Dom", [
    "base:Types",
    "base:Objs",
    "module:Info",
    "base:Async"
Severity: Major
Found in src/dom/dom.js - About 1 day to fix

    Function triggerDomEvent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            triggerDomEvent: function(element, eventName, parameters, customEventParams) {
                element = this.unbox(element);
                eventName = eventName.toLowerCase();
                var onEvent = "on" + eventName;
                var onEventHandler = null;
    Severity: Minor
    Found in src/dom/dom.js - About 1 hr to fix

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

              elementDimensions: function(element) {
                  element = this.unbox(element);
                  var cs, w, h;
                  if (element && window.getComputedStyle) {
                      try {
      Severity: Minor
      Found in src/dom/dom.js - About 1 hr to fix

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

                elementsByTemplate: function(template) {
                    template = template.trim();
                    var polyfill = Info.isInternetExplorer() && Info.internetExplorerVersion() < 9;
                    /*
                     * TODO: This is probably not a good fix.
        Severity: Minor
        Found in src/dom/dom.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      if (element && element.currentStyle) {
                          cs = element.currentStyle;
                          w = element.clientWidth - parseInt(cs.paddingLeft || 0, 10) - parseInt(cs.paddingRight || 0, 10);
                          h = element.clientHeight - parseInt(cs.paddingTop || 0, 10) - parseInt(cs.paddingTop || 0, 10);
                          if (w && h) {
          Severity: Major
          Found in src/dom/dom.js - About 40 mins to fix

            TODO found
            Open

                         * TODO: This is probably not a good fix.
            Severity: Minor
            Found in src/dom/dom.js by fixme

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

                        var visibleX = Math.max(0, Math.min(w, window.pageXOffset + window.innerWidth - x, right - window.pageXOffset));
            Severity: Minor
            Found in src/dom/dom.js and 1 other location - About 45 mins to fix
            src/dom/dom.js on lines 631..631

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

            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

                        var visibleY = Math.max(0, Math.min(h, window.pageYOffset + window.innerHeight - y, bottom - window.pageYOffset));
            Severity: Minor
            Found in src/dom/dom.js and 1 other location - About 45 mins to fix
            src/dom/dom.js on lines 630..630

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

            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

                            h = element.clientHeight - parseInt(cs.paddingTop || 0, 10) - parseInt(cs.paddingTop || 0, 10);
            Severity: Minor
            Found in src/dom/dom.js and 1 other location - About 30 mins to fix
            src/dom/dom.js on lines 472..472

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

            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

                            w = element.clientWidth - parseInt(cs.paddingLeft || 0, 10) - parseInt(cs.paddingRight || 0, 10);
            Severity: Minor
            Found in src/dom/dom.js and 1 other location - About 30 mins to fix
            src/dom/dom.js on lines 473..473

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

            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