Showing 3,294 of 3,294 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
- 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 69.
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 setInlineWidgetHeight
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Editor.prototype.setInlineWidgetHeight = function (inlineWidget, height, ensureVisible) {
var self = this,
node = inlineWidget.htmlContent,
oldHeight = (node && $(node).height()) || 0,
changed = (oldHeight !== height),
Function _handleMouseEnterOrExitScaleSticker
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
ImageView.prototype._handleMouseEnterOrExitScaleSticker = function (offsetX, offsetY) {
var imagePos = this.$imagePreview.position(),
scaleDivPos = this.$imageScale.position(),
imgWidth = this.$imagePreview.width(),
imgHeight = this.$imagePreview.height(),
Function shake
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.effects.effect.shake = function( o, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "effect" ),
Function conststatement
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var conststatement = stmt('const', function (prefix) {
var id, name, value;
this.first = [];
for (;;) {
Function varstatement
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var varstatement = stmt('var', function (prefix) {
// JavaScript does not have block scope. It only has function scope. So,
// declaring a variable in a block can have unexpected consequences.
var id, name, value;
Function _makeResizable
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_makeResizable: function( handles ) {
handles = (handles === undefined ? this.options.resizable : handles);
var that = this,
options = this.options,
// .ui-resizable has position: relative defined in the stylesheet
Function directives
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function directives() {
var i, p, pn;
for (;;) {
if (nexttoken.id === "(string)") {
Function load
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: function( index, event ) {
index = this._getIndex( index );
var that = this,
tab = this.tabs.eq( index ),
anchor = tab.find( ".ui-tabs-anchor" ),
Function add
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function( url, label, index ) {
if ( index === undefined ) {
index = this.anchors.length;
}
Function scale
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.effects.effect.scale = function( o, done ) {
// Create element
var el = $( this ),
options = $.extend( true, {}, o ),
Function writeFile
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function writeFile(path, data, options, callback) {
var encoding = options.encoding || "utf8",
preserveBOM = options.preserveBOM;
function _finishWrite(created) {
Function loadMetadata
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadMetadata(folder) {
var packageJSONFile = FileSystem.getFileForPath(folder + "/package.json"),
disabledFile = FileSystem.getFileForPath(folder + "/.disabled"),
baseName = FileUtils.getBaseName(folder),
result = new $.Deferred(),
Function _updateFromPrefs
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _updateFromPrefs(pref) {
var newMapping = PreferencesManager.get(pref),
newNames = Object.keys(newMapping),
state = _prefState[pref],
last = state.last,
Consider simplifying this complex logical expression. Open
if (isBlockComment) {
// Save the initial position to start searching for the suffix from here
initialPos = _.cloneDeep(ctx.pos);
// Find the position of the start of the prefix
Consider simplifying this complex logical expression. Open
if ( ( ( $target[0].id != $.datepicker._mainDivId &&
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
Consider simplifying this complex logical expression. Open
if (this.floating && horizontalDirection) {
return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
} else {
return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
}
Consider simplifying this complex logical expression. Open
if(!(/^(document|window|parent)$/).test(o.containment)) {
var ce = $(o.containment)[0];
var co = $(o.containment).offset();
var over = ($(ce).css("overflow") != 'hidden');
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!_.isEqual(section[id], value)) {
if (value === undefined) {
delete section[id];
} else {
section[id] = _.cloneDeep(value);
- 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 68.
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
function _attachListners() {
MainViewManager.on("workingSetMove.pane-first-pane", _handleWorkingSetMove);
MainViewManager.on("currentFileChange", handleCurrentFileChange);
MainViewManager.on("paneDestroy", _handlePaneMerge);
EditorManager.on("activeEditorChange", _handleActiveEditorChange);
- 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 68.
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