Showing 531 of 531 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( data.collisionWidth > outerWidth ) {
// element is initially over the left side of within
if ( overLeft > 0 && overRight <= 0 ) {
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
position.left += overLeft - newOverRight;
- 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 256.
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 ( data.collisionHeight > outerHeight ) {
// element is initially over the top of within
if ( overTop > 0 && overBottom <= 0 ) {
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
position.top += overTop - newOverBottom;
- 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 256.
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
Function ajax
has 241 lines of code (exceeds 25 allowed). Consider refactoring. Open
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
Function setDocument
has 230 lines of code (exceeds 25 allowed). Consider refactoring. Open
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
Function _create
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function() {
// Some browsers only repeat keydown events, not keypress events,
// so we use the suppressKeyPress flag to determine if we've already
// handled the keydown event. #7269
// Unfortunately the code for & in keypress is the same as the up arrow,
Function html
has 195 lines of code (exceeds 25 allowed). Consider refactoring. Open
function html() {
var a, attributes, e, n, q, t, v, w = option.white, wmode;
xmode = 'html';
xquote = '';
stack = null;
Function html
has 195 lines of code (exceeds 25 allowed). Consider refactoring. Open
function html() {
var a, attributes, e, n, q, t, v, w = option.white, wmode;
xmode = 'html';
xquote = '';
stack = null;
File 07-jquery.ui.menu.js
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery UI Menu 1.10.3
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
File 08-jquery.ui.autocomplete.js
has 471 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery UI Autocomplete 1.10.3
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
Method call
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def call(context, page)
geometry = context.params[:geometry]
trim = context.params[:trim]
ps = page.mime.to_s =~ /postscript/
if ps || page.mime == 'application/pdf'
- Read upRead up
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 _setDimension
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setDimension: function () {
var viewport = F.getViewport(),
steps = 0,
canShrink = false,
canExpand = false,
File 06-jquery.ui.position.js
has 419 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery UI Position 1.10.3
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
Function position
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.position = function( options ) {
if ( !options || !options.of ) {
return _position.apply( this, arguments );
}
File 05-jquery.ui.widget.js
has 403 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery UI Widget 1.10.3
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
Function itself
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
var itself = function (s, o) {
var a, i;
JSLINT.errors = [];
predefined = Object.create(standard);
if (o) {
Function itself
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
var itself = function (s, o) {
var a, i;
JSLINT.errors = [];
predefined = Object.create(standard);
if (o) {
File rugged_repository.rb
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
description 'Git repository backend (Using rugged library)'
require 'rugged'
require 'fileutils'
class RuggedRepository < Repository
Class Page
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Page
include Util
include Hooks
include Attributes
Function treeView
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.treeView = function(options) {
if (!options) {
options = {};
}
if (!options.root) {
Function Callbacks
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?