Showing 700 of 700 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else if( document.documentElement &&
document.documentElement.clientHeight ) {
d.pageYOffset = document.documentElement.scrollTop;
d.pageXOffset = document.documentElement.scrollLeft;
d.innerHeight = document.documentElement.clientHeight;
- 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 80.
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
for (var a = e - 1 >> 1; e > 0 && n.score < r[a].score; a = (e = a) - 1 >> 1) {
r[e] = r[a];
}
- 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 80.
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 treeCreate
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
treeCreate: function (ctx) {
this._superApply(arguments);
this.$container.addClass("fancytree-ext-wide");
var containerId,
File jquery.simulate.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery Simulate v@VERSION - simulate browser mouse and keyboard events
* https://github.com/jquery/jquery-simulate
*
* Copyright jQuery Foundation and other contributors
Function init
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
init = jQuery.fn.init = function( selector, context, root ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
Function updateBreadcrumb
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateBreadcrumb(key, loadTreeNodes) {
var $ol = $("ol.breadcrumb").addClass("busy"),
activeNode = taxonTree.getActiveNode();
if (activeNode && activeNode.key !== key) {
Function nodeSetFocus
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
nodeSetFocus: function (ctx, flag) {
// ctx.node.debug("nodeSetFocus(" + flag + ")");
var ctx2,
tree = ctx.tree,
node = ctx.node,
Function bridge
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string";
var args = widgetSlice.call( arguments, 1 );
Function bridge
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string";
var args = widgetSlice.call( arguments, 1 );
Function nodeRenderStatus
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
nodeRenderStatus: function (ctx) {
// Set classes for current status
var res,
node = ctx.node,
tree = ctx.tree,
Function bridge
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string";
var args = widgetSlice.call( arguments, 1 );
Function Test
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Test(settings) {
this.expected = null;
this.assertions = [];
this.module = config.currentModule;
this.steps = [];
Function mouseEvent
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
mouseEvent: function( type, options ) {
var event, eventDoc, doc, body;
options = $.extend({
bubbles: true,
cancelable: (type !== "mousemove"),
Function diffHalfMatch
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
DiffMatchPatch.prototype.diffHalfMatch = function (text1, text2) {
var longtext, shorttext, dmp, text1A, text2B, text2A, text1B, midCommon, hm1, hm2, hm;
longtext = text1.length > text2.length ? text1 : text2;
shorttext = text1.length > text2.length ? text2 : text1;
Function nodeSetSelected
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
nodeSetSelected: function (ctx, flag, callOpts) {
callOpts = callOpts || {};
var node = ctx.node,
tree = ctx.tree,
opts = ctx.options,
Function remove
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, origCount, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
Function _renderOptions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
_renderOptions: function(){
var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
opts = this.options,
actualOpts = plugin.options,
availOptList = opts.optionList,
Function treeInit
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
treeInit: function (ctx) {
var opts = ctx.options,
tree = ctx.tree;
this._superApply(arguments);
Function init
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function (options) {
var i,
opts = $.extend({}, defaultOptions, options),
hrefs = [],
$link = null,
Function buildFragment
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildFragment( elems, context, scripts, selection, ignored ) {
var elem, tmp, tag, wrap, attached, j,
fragment = context.createDocumentFragment(),
nodes = [],
i = 0,