Showing 611 of 611 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
*/_createClass(ResponsiveAccordionTabs,[{key:"_setup",value:function _setup(t,i){this.$element=e(t);this.$element.data("zfPluginBase",this);this.options=e.extend({},ResponsiveAccordionTabs.defaults,this.$element.data(),i);this.rules=this.$element.data("responsive-accordion-tabs");this.currentMq=null;this.currentRule=null;this.currentPlugin=null;this.className="ResponsiveAccordionTabs";this.$element.attr("id")||this.$element.attr("id",GetYoDigits(6,"responsiveaccordiontabs"));this._init();this._events()}},{key:"_init",value:function _init(){i._init();if("string"===typeof this.rules){var t={};var n=this.rules.split(" ");for(var s=0;s<n.length;s++){var a=n[s].split("-");var o=a.length>1?a[0]:"small";var r=a.length>1?a[1]:a[0];null!==Z[r]&&(t[o]=Z[r])}this.rules=t}this._getAllOptions();e.isEmptyObject(this.rules)||this._checkMediaQueries()}},{key:"_getAllOptions",value:function _getAllOptions(){var t=this;t.allOptions={};for(var i in Z)if(Z.hasOwnProperty(i)){var n=Z[i];try{var s=e("<ul></ul>");var a=new n.plugin(s,t.options);for(var o in a.options)if(a.options.hasOwnProperty(o)&&"zfPlugin"!==o){var r=a.options[o];t.allOptions[o]=r}a.destroy()}catch(e){console.warn("Warning: Problems getting Accordion/Tab options: ".concat(e))}}}},{key:"_events",value:function _events(){this._changedZfMediaQueryHandler=this._checkMediaQueries.bind(this);e(window).on("changed.zf.mediaquery",this._changedZfMediaQueryHandler)}},{key:"_checkMediaQueries",value:function _checkMediaQueries(){var t,n=this;e.each(this.rules,(function(e){i.atLeast(e)&&(t=e)}));if(t&&!(this.currentPlugin instanceof this.rules[t].plugin)){e.each(Z,(function(e,t){n.$element.removeClass(t.cssClass)}));this.$element.addClass(this.rules[t].cssClass);if(this.currentPlugin){!this.currentPlugin.$element.data("zfPlugin")&&this.storezfData&&this.currentPlugin.$element.data("zfPlugin",this.storezfData);this.currentPlugin.destroy()}this._handleMarkup(this.rules[t].cssClass);this.currentRule=this.rules[t];this.currentPlugin=new this.currentRule.plugin(this.$element,this.options);this.storezfData=this.currentPlugin.$element.data("zfPlugin")}}},{key:"_handleMarkup",value:function _handleMarkup(t){var i=this,n="accordion";var s=e("[data-tabs-content="+this.$element.attr("id")+"]");s.length&&(n="tabs");if(n!==t){var a=i.allOptions.linkClass?i.allOptions.linkClass:"tabs-title";var o=i.allOptions.panelClass?i.allOptions.panelClass:"tabs-panel";this.$element.removeAttr("role");var r=this.$element.children("."+a+",[data-accordion-item]").removeClass(a).removeClass("accordion-item").removeAttr("data-accordion-item");var l=r.children("a").removeClass("accordion-title");if("tabs"===n){s=s.children("."+o).removeClass(o).removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby");s.children("a").removeAttr("role").removeAttr("aria-controls").removeAttr("aria-selected")}else s=r.children("[data-tab-content]").removeClass("accordion-content");s.css({display:"",visibility:""});r.css({display:"",visibility:""});if("accordion"===t)s.each((function(t,n){e(n).appendTo(r.get(t)).addClass("accordion-content").attr("data-tab-content","").removeClass("is-active").css({height:""});e("[data-tabs-content="+i.$element.attr("id")+"]").after('<div id="tabs-placeholder-'+i.$element.attr("id")+'"></div>').detach();r.addClass("accordion-item").attr("data-accordion-item","");l.addClass("accordion-title")}));else if("tabs"===t){var c=e("[data-tabs-content="+i.$element.attr("id")+"]");var h=e("#tabs-placeholder-"+i.$element.attr("id"));if(h.length){c=e('<div class="tabs-content"></div>').insertAfter(h).attr("data-tabs-content",i.$element.attr("id"));h.remove()}else c=e('<div class="tabs-content"></div>').insertAfter(i.$element).attr("data-tabs-content",i.$element.attr("id"));s.each((function(t,i){var n=e(i).appendTo(c).addClass(o);var s=l.get(t).hash.slice(1);var a=e(i).attr("id")||GetYoDigits(6,"accordion");if(s!==a)if(""!==s)e(i).attr("id",s);else{s=a;e(i).attr("id",s);e(l.get(t)).attr("href",e(l.get(t)).attr("href").replace("#","")+"#"+s)}var h=e(r.get(t)).hasClass("is-active");h&&n.addClass("is-active")}));r.addClass(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 182.
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 HTMLParser
has 182 lines of code (exceeds 25 allowed). Consider refactoring. Open
t2 = e.arraysAreEqual, s = e.makeElement, l = e.tagName, r = e.getBlockTagNames, h = e.walkTree, o = e.findClosestElementFromNode, i = e.elementContainsNode, a = e.nodeIsAttachmentElement, u = e.normalizeSpaces, n = e.breakableWhitespacePattern, c = e.squishBreakableWhitespace, e.HTMLParser = function(d2) {
function g(t3, e2) {
this.html = t3, this.referenceElement = (e2 != null ? e2 : {}).referenceElement, this.blocks = [], this.blockElements = [], this.processedElements = [];
}
var m, v, y, b, A, C, x, w, E, S, R, k;
File geo.js
has 468 lines of code (exceeds 250 allowed). Consider refactoring. Open
function geojsonDaten() {
return {
"type": "FeatureCollection",
"features": [
{
File actioncable.esm-e01089c3ec4fe7817fa9abcad06cab6bdc387f95f0ca6aab4bf7ba7537f70690.js
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
var adapters = {
logger: self.console,
WebSocket: self.WebSocket
};
Function K
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
*/function emCalc(e){return parseInt(window.getComputedStyle(document.body,null).fontSize,10)*e}var K=function(t){_inherits(Tabs,t);var i=_createSuper(Tabs);function Tabs(){_classCallCheck(this,Tabs);return i.apply(this,arguments)}_createClass(Tabs,[{key:"_setup",value:
/**
* Creates a new instance of tabs.
* @class
* @name Tabs
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
class Subscription {
constructor(consumer, params = {}, mixin) {
this.consumer = consumer;
this.identifier = JSON.stringify(params);
extend(this, mixin);
- 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 176.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
class Subscription {
constructor(consumer, params = {}, mixin) {
this.consumer = consumer;
this.identifier = JSON.stringify(params);
extend(this, mixin);
- 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 176.
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 M
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
forceFollow:true};var M=function(t){_inherits(Equalizer,t);var n=_createSuper(Equalizer);function Equalizer(){_classCallCheck(this,Equalizer);return n.apply(this,arguments)}_createClass(Equalizer,[{key:"_setup",value:
/**
* Creates a new instance of Equalizer.
* @class
* @name Equalizer
- 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 T
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
validateOnBlur:false,patterns:{alpha:/^[a-zA-Z]+$/,alpha_numeric:/^[a-zA-Z0-9]+$/,integer:/^[-+]?\d+$/,number:/^[-+]?\d*(?:[\.\,]\d+)?$/,card:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(?:222[1-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,cvv:/^([0-9]){3,4}$/,email:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,url:/^((?:(https?|ftps?|file|ssh|sftp):\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))$/,domain:/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,datetime:/^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,date:/(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,time:/^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,dateISO:/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,month_day_year:/^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,day_month_year:/^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,color:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,website:{test:function test(e){return z.defaults.patterns.domain.test(e)||z.defaults.patterns.url.test(e)}}},validators:{equalTo:function equalTo(t){return e("#".concat(t.attr("data-equalto"))).val()===t.val()}}};var T=function(t){_inherits(Accordion,t);var i=_createSuper(Accordion);function Accordion(){_classCallCheck(this,Accordion);return i.apply(this,arguments)}_createClass(Accordion,[{key:"_setup",value:
/**
* Creates a new instance of an accordion.
* @class
* @name Accordion
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
*/},{key:"removeCheckboxErrorClasses",value:function removeCheckboxErrorClasses(e){var t=this.$element.find(':checkbox[name="'.concat(e,'"]'));var i=this.findCheckboxLabels(t);var n=this.findFormError(t);i.length&&i.removeClass(this.options.labelErrorClass);n.length&&n.removeClass(this.options.formErrorClass);t.removeClass(this.options.inputErrorClass).attr({"data-invalid":null,"aria-invalid":null})}
/**
* Removes CSS error class as specified by the Abide settings from the label, input, and the form
* @param {Object} $el - jQuery object to remove the class from
*/},{key:"removeErrorClasses",value:function removeErrorClasses(e){if("radio"===e[0].type)return this.removeRadioErrorClasses(e.attr("name"));if("checkbox"===e[0].type)return this.removeCheckboxErrorClasses(e.attr("name"));var t=this.findLabel(e);var i=this.findFormError(e);t.length&&t.removeClass(this.options.labelErrorClass);i.length&&i.removeClass(this.options.formErrorClass);e.removeClass(this.options.inputErrorClass).attr({"data-invalid":null,"aria-invalid":null});e.data("abide-describedby")&&e.removeAttr("aria-describedby").removeData("abide-describedby")}
- 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 172.
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
*/},{key:"removeRadioErrorClasses",value:function removeRadioErrorClasses(e){var t=this.$element.find(':radio[name="'.concat(e,'"]'));var i=this.findRadioLabels(t);var n=this.findFormError(t);i.length&&i.removeClass(this.options.labelErrorClass);n.length&&n.removeClass(this.options.formErrorClass);t.removeClass(this.options.inputErrorClass).attr({"data-invalid":null,"aria-invalid":null})}
/**
* Remove CSS error classes etc from an entire checkbox group
* @param {String} groupName - A string that specifies the name of a checkbox group
*
- 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 172.
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 q
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
offset:0};var q=function(t){_inherits(Magellan,t);var i=_createSuper(Magellan);function Magellan(){_classCallCheck(this,Magellan);return i.apply(this,arguments)}_createClass(Magellan,[{key:"_setup",value:
/**
* Creates a new instance of Magellan.
* @class
* @name Magellan
- 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 Text
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
e.Text = function(n2) {
function i(t3) {
var n3;
t3 == null && (t3 = []), i.__super__.constructor.apply(this, arguments), this.pieceList = new e.SplittableList(function() {
var e2, i2, o;
Function popperGenerator
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
function popperGenerator(generatorOptions) {
if (generatorOptions === void 0) {
generatorOptions = {};
}
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers3 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
Function Level0InputController
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
c = e.makeElement, l = e.objectsAreEqual, d = e.tagName, n = e.browser, a = e.keyEventIsKeyboardCommand, o = e.dataTransferIsWritable, i = e.dataTransferIsPlainText, u = e.config.keyNames, e.Level0InputController = function(n2) {
function s2() {
s2.__super__.constructor.apply(this, arguments), this.resetInputSummary();
}
var d2;
Function createPopper4
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function createPopper4(reference2, popper2, options) {
if (options === void 0) {
options = defaultOptions;
}
var state = {
Similar blocks of code found in 2 locations. Consider refactoring. Open
*/},{key:"_openTab",value:function _openTab(t){var i=this;var n=t.parent();var s=t.attr("aria-labelledby");t.attr("aria-hidden",false);n.addClass("is-active");e("#".concat(s)).attr({"aria-expanded":true});t.finish().slideDown(this.options.slideSpeed,(function(){i.$element.trigger("down.zf.accordion",[t])}))}
- 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 148.
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
*/},{key:"_closeTab",value:function _closeTab(t){var i=this;var n=t.parent();var s=t.attr("aria-labelledby");t.attr("aria-hidden",true);n.removeClass("is-active");e("#".concat(s)).attr({"aria-expanded":false});t.finish().slideUp(this.options.slideSpeed,(function(){i.$element.trigger("up.zf.accordion",[t])}))}},{key:"_closeAllTabs",value:function _closeAllTabs(){var e=this.$element.children(".is-active").children("[data-tab-content]");e.length&&this._closeTab(e)}},{key:"_destroy",value:function _destroy(){this.$element.find("[data-tab-content]").stop(true).slideUp(0).css("display","");this.$element.find("a").off(".zf.accordion");this.options.deepLink&&e(window).off("hashchange",this._checkDeepLink)}}]);return Accordion}(C);T.defaults={
- 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 148.
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 Block
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
t2 = e.arraysAreEqual, r = e.spliceArray, i = e.getBlockConfig, n = e.getBlockAttributeNames, o = e.getListAttributeNames, e.Block = function(n2) {
function a2(t3, n3) {
t3 == null && (t3 = new e.Text()), n3 == null && (n3 = []), a2.__super__.constructor.apply(this, arguments), this.text = h(t3), this.attributes = n3;
}
var l, h, p, d, f, g, m, v, y;
Function P
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
equalizeOn:""};var P=function(t){_inherits(Interchange,t);var n=_createSuper(Interchange);function Interchange(){_classCallCheck(this,Interchange);return n.apply(this,arguments)}_createClass(Interchange,[{key:"_setup",value:
/**
* Creates a new instance of Interchange.
* @class
* @name Interchange
- 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"