le0pard/mongodb_logger

View on GitHub

Showing 86 of 86 total issues

File rickshaw.js has 1955 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Rickshaw = {

    namespace: function(namespace, obj) {

        var parts = namespace.split('.');
Severity: Major
Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 5 days to fix

    Function ClassList has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    Rickshaw.Compat.ClassList = function() {
    
        /* adapted from http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
    
        if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) {
    Severity: Minor
    Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 1 day 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 Graph has 159 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Rickshaw.Graph = function(args) {
    
        this.element = args.element;
        this.series = args.series;
    
    
    Severity: Major
    Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 6 hrs to fix

      Function Color has 146 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Rickshaw.Fixtures.Color = function() {
      
          this.schemes = {};
      
          this.schemes.spectrum14 = [
      Severity: Major
      Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 5 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            else if (y >= 1099511627776){ return y / 1099511627776 + "T" }
            else if (y >= 1073741824)   { return y / 1073741824 + "G" }
            else if (y >= 1048576)      { return y / 1048576 + "M" }
            else if (y >= 1024)         { return y / 1024 + "K" }
            else if (y < 1 && y > 0)    { return y.toFixed(2) }
        Severity: Major
        Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js and 1 other location - About 5 hrs to fix
        app/assets/javascripts/vendors/rickshaw/rickshaw.js on lines 908..914

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 144.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if (y >= 1000000000000)   { return y / 1000000000000 + "T" } 
            else if (y >= 1000000000) { return y / 1000000000 + "B" } 
            else if (y >= 1000000)    { return y / 1000000 + "M" } 
            else if (y >= 1000)       { return y / 1000 + "K" }
            else if (y < 1 && y > 0)  { return y.toFixed(2) }
        Severity: Major
        Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js and 1 other location - About 5 hrs to fix
        app/assets/javascripts/vendors/rickshaw/rickshaw.js on lines 919..925

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 144.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function ClassList has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Rickshaw.Compat.ClassList = function() {
        
            /* adapted from http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
        
            if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) {
        Severity: Major
        Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 4 hrs to fix

          Function Graph has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          Rickshaw.Graph = function(args) {
          
              this.element = args.element;
              this.series = args.series;
          
          
          Severity: Minor
          Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 4 hrs 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 Toggle has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          Rickshaw.Graph.Behavior.Series.Toggle = function(args) {
          
              this.graph = args.graph;
              this.legend = args.legend;
          
          
          Severity: Minor
          Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 3 hrs 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  return d3.svg.area()
                      .x( function(d) { return graph.x(d.x) } )
                      .y0( function(d) { return graph.y(d.y0) } )
                      .y1( function(d) { return graph.y(d.y + d.y0) } )
                      .interpolate(graph.interpolation).tension(this.tension);
          Severity: Major
          Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/vendors/rickshaw/rickshaw.js on lines 2056..2060

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 112.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  return d3.svg.area()
                      .x( function(d) { return graph.x(d.x) } )
                      .y0( function(d) { return graph.y(d.y0) } )
                      .y1( function(d) { return graph.y(d.y + d.y0) } )
                      .interpolate(this.graph.interpolation).tension(this.tension);
          Severity: Major
          Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/vendors/rickshaw/rickshaw.js on lines 2198..2202

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 112.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function Time has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Rickshaw.Fixtures.Time = function() {
          
              var tzOffset = new Date().getTimezoneOffset() * 60;
          
              var self = this;
          Severity: Major
          Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 3 hrs to fix

            Function Toggle has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Rickshaw.Graph.Behavior.Series.Toggle = function(args) {
            
                this.graph = args.graph;
                this.legend = args.legend;
            
            
            Severity: Major
            Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 3 hrs to fix

              Function Annotate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Rickshaw.Graph.Annotate = function(args) {
              
                  var graph = this.graph = args.graph;
                  this.elements = { timeline: args.element };
                  
              Severity: Major
              Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 2 hrs to fix

                Method build_mongo_conditions has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                      def build_mongo_conditions
                        @mongo_conditions = Hash.new
                        FIXED_PARAMS_ON_FORM.each do |param_key|
                          value = self.send param_key
                          mkey_val = case param_key
                Severity: Minor
                Found in lib/mongodb_logger/server/model/filter.rb - About 2 hrs 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 Y has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Rickshaw.Graph.Axis.Y = function(args) {
                
                    var self = this;
                    var berthRate = 0.10;
                
                
                Severity: Major
                Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 2 hrs to fix

                  Function Y has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Rickshaw.Graph.Axis.Y = function(args) {
                  
                      var self = this;
                      var berthRate = 0.10;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 2 hrs 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 Class has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var Class = (function() {
                    
                    // Some versions of JScript fail to enumerate over properties, names of which 
                    // correspond to non-enumerable properties in the prototype chain
                    var IS_DONTENUM_BUGGY = (function(){
                  Severity: Major
                  Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 2 hrs to fix

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

                        this.update = function() {
                    
                            Rickshaw.keys(self.data).forEach( function(time) {
                    
                                var annotation = self.data[time];
                    Severity: Major
                    Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - About 2 hrs to fix

                      Class Logger has 22 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class Logger < RailsLogger
                          include ReplicaSetHelper
                      
                          DEFAULT_COLLECTION_SIZE = 250.megabytes
                          # Looks for configuration files in this order
                      Severity: Minor
                      Found in lib/mongodb_logger/logger.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language