Showing 282 of 417 total issues
Method initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(user)
group_member_data = [Example, LingsProperty, ExamplesLingsProperty]
group_admin_data = [Ling, Property, Category, Membership]
group_data = group_admin_data + group_member_data
- 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 create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def create
@example = Example.new(params[:example]) do |example|
example.group = current_group
example.creator = current_user
end
- 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 renderChildren
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.renderChildren = function(ctx) {
var textAnchor = this.style('text-anchor').valueOrDefault('start');
var x = this.attribute('x').toPixels('x');
var y = this.attribute('y').toPixels('y');
for (var i=0; i<this.children.length; i++) {
Function PathElementBase
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
svg.Element.PathElementBase = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.path = function(ctx) {
Function filter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
svg.Element.filter = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.apply = function(ctx, element) {
Function addBezierCurve
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
// from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
var p0 = [p0x, p0y], p1 = [p1x, p1y], p2 = [p2x, p2y], p3 = [p3x, p3y];
this.addPoint(p0[0], p0[1]);
this.addPoint(p3[0], p3[1]);
Function attr
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
Function createServiceMarkersFromMarkers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Gmaps4Rails.prototype.createServiceMarkersFromMarkers = function() {
var Lat, LatLng, Lng, index, marker, _len, _ref;
_ref = this.markers;
for (index = 0, _len = _ref.length; index < _len; index++) {
marker = _ref[index];
Function create_polyline
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Gmaps4Rails.prototype.create_polyline = function(polyline) {
var clickable, decoded_array, element, latlng, new_poly, point, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _j, _len, _len2;
polyline_coordinates = [];
for (_i = 0, _len = polyline.length; _i < _len; _i++) {
element = polyline[_i];
Method initialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(user)
group_member_data = [Example, LingsProperty, ExamplesLingsProperty]
group_admin_data = [Ling, Property, Category, Membership]
group_data = group_admin_data + group_member_data
Function createGradient
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.createGradient = function(ctx, element) {
var stopsContainer = this;
if (this.attribute('xlink:href').hasValue()) {
stopsContainer = this.attribute('xlink:href').getDefinition();
}
Consider simplifying this complex logical expression. Open
Open
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
Function closest
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) {
Function each
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
Function create_circle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Gmaps4Rails.prototype.create_circle = function(circle) {
var newCircle;
if (circle === this.circles[0]) {
if (circle.strokeColor != null) {
this.circles_conf.strokeColor = circle.strokeColor;
Function getHelpXML
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.getHelpXML = function () {
var examples = new Array();
// add regexps
for (var i = 0; i < color_defs.length; i++) {
Function ATTR
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Function setOffset
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
Function canvg
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.canvg = function (target, s, opts) {
// no parameters
if (target == null && s == null && opts == null) {
var svgTags = document.getElementsByTagName('svg');
for (var i=0; i<svgTags.length; i++) {
Function AspectRatio
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
svg.AspectRatio = function(ctx, aspectRatio, width, desiredWidth, height, desiredHeight, minX, minY, refX, refY) {