RailsStudyGroup/redditgraphed

View on GitHub

Showing 34 of 97 total issues

File Chart.js has 2453 lines of code (exceeds 250 allowed). Consider refactoring.
Open


/*!
* Chart.js
* http://chartjs.org/
*
Severity: Major
Found in app/assets/javascripts/Chart.js - About 6 days to fix

    Function notify has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function notify(map) {
    var options = getOptions(),
    iconClass = map.iconClass || options.iconClass;
    if (options.preventDuplicates) {
    if (map.message === previousToast) {
    Severity: Major
    Found in app/assets/javascripts/toastr.js - About 5 hrs to fix

      Function showTooltip has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      showTooltip : function(ChartElements, forceRedraw){
      // Only redraw the chart if we've actually changed what we're hovering on.
      if (typeof this.activeElements === 'undefined') this.activeElements = [];
      
      var isChanged = (function(Elements){
      Severity: Major
      Found in app/assets/javascripts/Chart.js - About 4 hrs to fix

        Function draw has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        draw: function(){
        if (this.display){
        var ctx = this.ctx;
        each(this.yLabels, function(label, index){
        // Don't draw a centre value
        Severity: Major
        Found in app/assets/javascripts/Chart.js - About 3 hrs to fix

          File toastr.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
          * Toastr
          * Copyright 2012-2014
          * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
          * All Rights Reserved.
          Severity: Minor
          Found in app/assets/javascripts/toastr.js - About 3 hrs to fix

            Function initialize has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            initialize: function(data){
            
            //Expose options as a scope variable here so we can access it in the ScaleClass
            var options = this.options;
            
            
            Severity: Major
            Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

              Function draw has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              draw : function(){
              var ctx = this.ctx,
              yLabelGap = (this.endPoint - this.startPoint) / this.steps,
              xStart = Math.round(this.xScalePaddingLeft);
              if (this.display){
              Severity: Major
              Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                File nprogress.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
                 * @license MIT */
                
                ;(function(root, factory) {
                
                
                Severity: Minor
                Found in app/assets/javascripts/nprogress.js - About 2 hrs to fix

                  Function draw has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  draw : function(ease){
                  var easingDecimal = ease || 1;
                  this.clear();
                  
                  var ctx = this.chart.ctx;
                  Severity: Major
                  Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                    Function initialize has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    initialize: function(data){
                    //Declare the extension of the default point, to cater for the options passed in to the constructor
                    this.PointClass = Chart.Point.extend({
                    strokeWidth : this.options.pointDotStrokeWidth,
                    radius : this.options.pointDotRadius,
                    Severity: Major
                    Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                      Function calculateScaleRange has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      calculateScaleRange = helpers.calculateScaleRange = function(valuesArray, drawingSize, textSize, startFromZero, integersOnly){
                      
                      //Set a minimum step of two - a point at the top of the graph, and a point at the base
                      var minSteps = 2,
                      maxSteps = Math.floor(drawingSize/(textSize * 1.5)),
                      Severity: Major
                      Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                        Function setScaleSize has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        setScaleSize: function(){
                        /*
                        * Right, this is really confusing and there is a lot of maths going on here
                        * The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
                        *
                        Severity: Major
                        Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                          Function draw has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          draw : function(){
                          
                          var ctx = this.chart.ctx;
                          
                          ctx.font = fontString(this.fontSize,this.fontStyle,this.fontFamily);
                          Severity: Major
                          Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                            Function initialize has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            initialize: function(data){
                            this.PointClass = Chart.Point.extend({
                            strokeWidth : this.options.pointDotStrokeWidth,
                            radius : this.options.pointDotRadius,
                            display: this.options.pointDot,
                            Severity: Major
                            Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                              Function buildScale has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              buildScale : function(labels){
                              var self = this;
                              
                              var dataTotal = function(){
                              var values = [];
                              Severity: Minor
                              Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                                Function initialize has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                initialize: function(data){
                                this.segments = [];
                                //Declare segment class as a chart instance specific class, so it can share props for this instance
                                this.SegmentArc = Chart.Arc.extend({
                                showStroke : this.options.segmentShowStroke,
                                Severity: Minor
                                Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                                  Function buildScale has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  buildScale : function(labels){
                                  var self = this;
                                  
                                  var dataTotal = function(){
                                  var values = [];
                                  Severity: Minor
                                  Found in app/assets/javascripts/Chart.js - About 2 hrs to fix

                                    Function css has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      var css = (function() {
                                        var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
                                            cssProps    = {};
                                    
                                        function camelCase(string) {
                                    Severity: Minor
                                    Found in app/assets/javascripts/nprogress.js - About 1 hr to fix

                                      Method create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        def create
                                          build_resource(sign_up_params)
                                          resource.name = params[:user][:name]
                                          resource.save
                                          yield resource if block_given?
                                      Severity: Minor
                                      Found in app/controllers/users/registrations_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 calculateXLabelRotation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      calculateXLabelRotation : function(){
                                      //Get the width of each grid by calculating the difference
                                      //between x offsets between 0 and 1.
                                      
                                      this.ctx.font = this.font;
                                      Severity: Minor
                                      Found in app/assets/javascripts/Chart.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language