linguisticexplorer/Linguistic-Explorer

View on GitHub

Showing 282 of 417 total issues

Method initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
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

Severity: Minor
Found in app/models/ability.rb - About 1 hr to fix

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

  def create
    @example = Example.new(params[:example]) do |example|
      example.group = current_group
      example.creator = current_user
    end
Severity: Minor
Found in app/controllers/examples_controller.rb - About 1 hr to fix

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

            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++) {
Severity: Minor
Found in public/javascripts/canvg.js - About 1 hr to fix

    Function PathElementBase has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            svg.Element.PathElementBase = function(node) {
                this.base = svg.Element.RenderedElementBase;
                this.base(node);
                
                this.path = function(ctx) {
    Severity: Minor
    Found in public/javascripts/canvg.js - About 1 hr to fix

      Function filter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              svg.Element.filter = function(node) {
                  this.base = svg.Element.ElementBase;
                  this.base(node);
                              
                  this.apply = function(ctx, element) {
      Severity: Minor
      Found in public/javascripts/canvg.js - About 1 hr to fix

        Function addBezierCurve has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        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]);
        Severity: Minor
        Found in public/javascripts/canvg.js - About 1 hr to fix

          Function attr has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          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
          Severity: Minor
          Found in public/javascripts/jquery.js - About 1 hr to fix

            Function createServiceMarkersFromMarkers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            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];
            Severity: Minor
            Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

              Function create_polyline has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              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];
              Severity: Minor
              Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                Method initialize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                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
                
                
                Severity: Minor
                Found in app/models/ability.rb - About 1 hr to fix

                  Function createGradient has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              this.createGradient = function(ctx, element) {
                                  var stopsContainer = this;
                                  if (this.attribute('xlink:href').hasValue()) {
                                      stopsContainer = this.attribute('xlink:href').getDefinition();
                                  }
                  Severity: Minor
                  Found in public/javascripts/canvg.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if ( match[1] === "nth" ) {
                                    if ( !match[2] ) {
                                        Sizzle.error( match[0] );
                                    }
                    
                    
                    Severity: Critical
                    Found in public/javascripts/jquery.js - About 1 hr to fix

                      Function closest has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          closest: function( selectors, context ) {
                              var ret = [], i, l, cur = this[0];
                              
                              // Array (deprecated as of jQuery 1.7)
                              if ( jQuery.isArray( selectors ) ) {
                      Severity: Minor
                      Found in public/javascripts/jquery.js - About 1 hr to fix

                        Function each has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            each: function( object, callback, args ) {
                                var name, i = 0,
                                    length = object.length,
                                    isObj = length === undefined || jQuery.isFunction( object );
                        
                        
                        Severity: Minor
                        Found in public/javascripts/jquery.js - About 1 hr to fix

                          Function create_circle has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              Gmaps4Rails.prototype.create_circle = function(circle) {
                                var newCircle;
                                if (circle === this.circles[0]) {
                                  if (circle.strokeColor != null) {
                                    this.circles_conf.strokeColor = circle.strokeColor;
                          Severity: Minor
                          Found in public/javascripts/gmaps4rails/gmaps4rails.base.js - About 1 hr to fix

                            Function getHelpXML has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                this.getHelpXML = function () {
                            
                                    var examples = new Array();
                                    // add regexps
                                    for (var i = 0; i < color_defs.length; i++) {
                            Severity: Minor
                            Found in public/javascripts/rgbcolor.js - About 1 hr to fix

                              Function ATTR has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      ATTR: function( elem, match ) {
                                          var name = match[1],
                                              result = Sizzle.attr ?
                                                  Sizzle.attr( elem, name ) :
                                                  Expr.attrHandle[ name ] ?
                              Severity: Minor
                              Found in public/javascripts/jquery.js - About 1 hr to fix

                                Function setOffset has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                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" ) {
                                Severity: Minor
                                Found in public/javascripts/jquery.js - About 1 hr to fix

                                  Function canvg has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  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++) {
                                  Severity: Minor
                                  Found in public/javascripts/canvg.js - About 1 hr to fix

                                    Function AspectRatio has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            svg.AspectRatio = function(ctx, aspectRatio, width, desiredWidth, height, desiredHeight, minX, minY, refX, refY) {
                                    Severity: Major
                                    Found in public/javascripts/canvg.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language