Showing 371 of 658 total issues
Function focus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
focus: function( event, item ) {
var nested, focused;
this.blur( event, event && event.type === "focus" );
this._scrollIntoView( item );
Function _mouseStop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_mouseStop: function(event) {
this.resizing = false;
var pr, ista, soffseth, soffsetw, s, left, top,
o = this.options, that = this;
Function off
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
Function offset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
Method method_missing
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def method_missing(missing_method, *args, &block)
method_name, reference_identifier = missing_method.to_s.split("_", 2)
type = full(method_name)
Surveyor::Parser.raise_error( "\"#{type}\" is not a surveyor method." )if !%w(survey survey_translation survey_section question_group question dependency dependency_condition answer validation validation_condition).include?(type)
Consider simplifying this complex logical expression. Open
Open
if ($.datepicker._datepickerShowing) {
switch (event.keyCode) {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
Function _generateMonthYearHeader
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort) {
Consider simplifying this complex logical expression. Open
Open
if ( this.options.tolerance === "pointer" ||
this.options.forcePointerForContainers ||
(this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
) {
return isOverElement;
Consider simplifying this complex logical expression. Open
Open
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
Consider simplifying this complex logical expression. Open
Open
if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
if(that._trigger("stop", event) !== false) {
that._clear();
}
Consider simplifying this complex logical expression. Open
Open
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
Consider simplifying this complex logical expression. Open
Open
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
Method load_and_update_response_set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def load_and_update_response_set
ResponseSet.transaction do
@response_set = ResponseSet.includes({:responses => :answer}).where(:access_code => params[:response_set_code]).first
if @response_set
saved = true
- 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
Method unparse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def unparse(dsl)
with_defaults = SurveySection.new(:title => title)
attrs = self.attributes.delete_if{|k,v| with_defaults[k] == v or %w(created_at updated_at id survey_id).include? k}.symbolize_keys!
group_questions = []
dsl << " section \"#{title}\""
- 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 create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
create: function(tp_inst, obj, unit, val, min, max, step){
Function access
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
Function create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
create: function(tp_inst, obj, unit, val, min, max, step){
Method generate_pick_none_input_html
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def generate_pick_none_input_html(value, default_value, css_class, response_class, disabled, input_mask, input_mask_placeholder)
Avoid deeply nested control flow statements. Open
Open
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
Avoid deeply nested control flow statements. Open
Open
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {