Showing 250 of 250 total issues
Function promise
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
Function checkPosition
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var scrollHeight = $(document).height()
var scrollTop = this.$target.scrollTop()
Function attr
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
attr: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set attributes on text, comment and attribute nodes
Function html
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
html: function( value ) {
return access( this, function( value ) {
var elem = this[ 0 ] || {},
i = 0,
l = this.length;
Function show
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
OffCanvas.prototype.show = function () {
if (this.state) return
var startEvent = $.Event('show.bs.offcanvas')
this.$element.trigger(startEvent)
Function checkVal
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Inputmask.prototype.checkVal = function(allow) {
var len = this.mask.length
//try to place characters where they belong
var test = this.$element.val()
var lastMatch = -1
Function show
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
Function checkVal
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Inputmask.prototype.checkVal = function(allow) {
var len = this.mask.length
//try to place characters where they belong
var test = this.$element.val()
var lastMatch = -1
Function show
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
OffCanvas.prototype.show = function () {
if (this.state) return
var startEvent = $.Event('show.bs.offcanvas')
this.$element.trigger(startEvent)
Function fix
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
Function addClass
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
addClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
Function finish
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each( function() {
Function blankInputs
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
blankInputs: function(form, specifiedSelector, nonBlank) {
var foundInputs = $(),
input,
valueToCheck,
radiosForNameWithNoneSelected,
Function caret
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Inputmask.prototype.caret = function(begin, end) {
if (this.$element.length === 0) return
if (typeof begin == 'number') {
end = (typeof end == 'number') ? end : begin
return this.$element.each(function() {
Function off
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
Function caret
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Inputmask.prototype.caret = function(begin, end) {
if (this.$element.length === 0) return
if (typeof begin == 'number') {
end = (typeof end == 'number') ? end : begin
return this.$element.each(function() {
Similar blocks of code found in 2 locations. Consider refactoring. Open
disableFormElements: function(form) {
rails.formElements(form, rails.disableSelector).each(function() {
rails.disableFormElement($(this));
});
},
- 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
enableFormElements: function(form) {
rails.formElements(form, rails.enableSelector).each(function() {
rails.enableFormElement($(this));
});
},
- 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
Function propFilter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
Function activate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')