mozilla/webmaker.org

View on GitHub
public/js/lib/jquery.powertip.js

Summary

Maintainability
F
5 days
Test Coverage

File jquery.powertip.js has 715 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 PowerTip - v1.2.0 - 2013-04-03
 http://stevenbenner.github.com/jquery-powertip/
 Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).
 Released under MIT license.
Severity: Major
Found in public/js/lib/jquery.powertip.js - About 1 day to fix

    Function TooltipController has 197 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function TooltipController(options) {
            var placementCalculator = new PlacementCalculator(),
                tipElement = $('#' + options.popupId);
    
            // build and append tooltip div if it does not already exist
    Severity: Major
    Found in public/js/lib/jquery.powertip.js - About 7 hrs to fix

      Function PlacementCalculator has 162 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function PlacementCalculator() {
              /**
               * Compute the CSS position to display a tooltip at the specified placement
               * relative to the specified element.
               * @private
      Severity: Major
      Found in public/js/lib/jquery.powertip.js - About 6 hrs to fix

        Function DisplayController has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function DisplayController(element, options, tipController) {
                var hoverTimer = null;
        
                /**
                 * Begins the process of showing a tooltip.
        Severity: Major
        Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

          Function computePlacementCoords has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
                      var placementBase = placement.split('-')[0], // ignore 'alt' for corners
                          coords = new CSSCoordinates(),
                          position;
          
          
          Severity: Major
          Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

            Function getSvgPlacement has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function getSvgPlacement(element, placement) {
                        var svgElement = element.closest('svg')[0],
                            domElement = element[0],
                            point = svgElement.createSVGPoint(),
                            boundingBox = domElement.getBBox(),
            Severity: Major
            Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

              Function powerTip has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $.fn.powerTip = function(opts, arg) {
                      // don't do any work if there were no matched elements
                      if (!this.length) {
                          return this;
                      }
              Severity: Major
              Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

                Function getHtmlPlacement has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function getHtmlPlacement(element, placement) {
                            var objectOffset = element.offset(),
                                objectWidth = element.outerWidth(),
                                objectHeight = element.outerHeight(),
                                left,
                Severity: Minor
                Found in public/js/lib/jquery.powertip.js - About 1 hr to fix

                  Function showTip has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function showTip(element) {
                              var tipContent;
                  
                              // it is possible, especially with keyboard navigation, to move on to
                              // another element with a tooltip during the queue to get to this point
                  Severity: Minor
                  Found in public/js/lib/jquery.powertip.js - About 1 hr to fix

                    Function initTracking has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function initTracking() {
                            if (!session.mouseTrackingActive) {
                                session.mouseTrackingActive = true;
                    
                                // grab the current viewport dimensions on load
                    Severity: Minor
                    Found in public/js/lib/jquery.powertip.js - About 1 hr to fix

                      Function positionTipOnCursor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function positionTipOnCursor() {
                                  // to support having fixed tooltips on the same page as cursor tooltips,
                                  // where both instances are referencing the same tooltip element, we
                                  // need to keep track of the mouse position constantly, but we should
                                  // only set the tip location if a fixed tip is not currently open, a tip
                      Severity: Minor
                      Found in public/js/lib/jquery.powertip.js - About 1 hr to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (!isMouseOver(tipElement)) {
                                                        isDesynced = true;
                                                    }
                        Severity: Major
                        Found in public/js/lib/jquery.powertip.js - About 45 mins to fix

                          Function computePlacementCoords has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
                          Severity: Minor
                          Found in public/js/lib/jquery.powertip.js - About 35 mins to fix

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

                                        case 'n':
                                            coords.set('left', position.left - (tipWidth / 2));
                                            coords.set('bottom', session.windowHeight - position.top + offset);
                                            break;
                            Severity: Major
                            Found in public/js/lib/jquery.powertip.js and 1 other location - About 1 hr to fix
                            public/js/lib/jquery.powertip.js on lines 452..455

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

                            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 'w':
                                            coords.set('top', position.top - (tipHeight / 2));
                                            coords.set('right', session.windowWidth - position.left + offset);
                                            break;
                            Severity: Major
                            Found in public/js/lib/jquery.powertip.js and 1 other location - About 1 hr to fix
                            public/js/lib/jquery.powertip.js on lines 440..443

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

                            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 (x !== session.scrollLeft) {
                                                    session.currentX += x - session.scrollLeft;
                                                    session.scrollLeft = x;
                                                }
                            Severity: Minor
                            Found in public/js/lib/jquery.powertip.js and 1 other location - About 30 mins to fix
                            public/js/lib/jquery.powertip.js on lines 1043..1046

                            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

                                                if (y !== session.scrollTop) {
                                                    session.currentY += y - session.scrollTop;
                                                    session.scrollTop = y;
                                                }
                            Severity: Minor
                            Found in public/js/lib/jquery.powertip.js and 1 other location - About 30 mins to fix
                            public/js/lib/jquery.powertip.js on lines 1039..1042

                            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