Showing 282 of 417 total issues
Method display_example
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def display_example(example_id, display_mode)
example = Example.find(example_id)
result = ""
example.group.example_storable_keys.each do |key|
case display_mode
- 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 result_headers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def result_headers(entry=nil)
header_keys ||= result_headers_cross(entry) if @search.cross? || @search.implication?
header_keys ||= result_headers_compare(entry) if @search.compare?
if @search.default?
header_keys ||= columns_to_include
- 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 validate_csv_header
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_csv_header(key, check)
file = @config[key]
text = File.read(file){|f| f.readline}
header = @headers[key]
- 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 html
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
Function show
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
Function setup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
Function addClass
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
Function createMarker
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4RailsMapquest.prototype.createMarker = function(args) {
var icon, marker;
marker = new MQA.Poi({
lat: args.Lat,
lng: args.Lng
Function use
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
svg.Element.use = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.baseSetContext = this.setContext;
Function cloneFixAttributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
Function >
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
Function buildFragment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
Function rect
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
svg.Element.rect = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
this.path = function(ctx) {
Function create_polygon
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4Rails.prototype.create_polygon = function(polygon) {
var clickable, fillColor, fillOpacity, latlng, new_poly, point, polygon_coordinates, strokeColor, strokeOpacity, strokeWeight, _i, _len;
polygon_coordinates = [];
for (_i = 0, _len = polygon.length; _i < _len; _i++) {
point = polygon[_i];
Function getGradient
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.getGradient = function(ctx, element) {
var bb = element.getBoundingBox();
if (!this.attribute('cx').hasValue()) this.attribute('cx', true).value = '50%';
if (!this.attribute('cy').hasValue()) this.attribute('cy', true).value = '50%';
Consider simplifying this complex logical expression. Open
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
Consider simplifying this complex logical expression. Open
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
Consider simplifying this complex logical expression. Open
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
Function addBezierCurve
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
Consider simplifying this complex logical expression. Open
if (point === polygon[0]) {
strokeColor = point.strokeColor || this.polygons_conf.strokeColor;
strokeOpacity = point.strokeOpacity || this.polygons_conf.strokeOpacity;
strokeWeight = point.strokeWeight || this.polygons_conf.strokeWeight;
fillColor = point.fillColor || this.polygons_conf.fillColor;