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.
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
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
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.
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;
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(),
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;
}
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,
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
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
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
Avoid deeply nested control flow statements. Open
if (!isMouseOver(tipElement)) {
isDesynced = true;
}
Function computePlacementCoords
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
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;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (x !== session.scrollLeft) {
session.currentX += x - session.scrollLeft;
session.scrollLeft = x;
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (y !== session.scrollTop) {
session.currentY += y - session.scrollTop;
session.scrollTop = y;
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76