theodi/metrics-api

View on GitHub

Showing 31 of 71 total issues

Method registered has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.registered(app)

      app.get '/metrics' do
        @metrics = list_metrics
        @title = 'Metrics API'
Severity: Major
Found in lib/bothan/metrics.rb - About 4 hrs to fix

    Function buildTable has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function buildTable(row_num, col_num) {
      table = $('#dashboard');
    
      form = $('#metric-template').clone();
      form.removeClass('hidden')
    Severity: Minor
    Found in lib/public/javascripts/dashboard.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

    File dashboard.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    function growRow(td, span, cell_content) {
      var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
      var row = td.closest("tr")
      var index = td.index()
      var old_span = (typeof td.attr('rowspan') === 'undefined') ? 1 : Number(td.attr('rowspan'))
    Severity: Minor
    Found in lib/public/javascripts/dashboard.js - About 3 hrs to fix

      Method registered has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.registered(app)
      
            app.get '/metrics' do
              @metrics = list_metrics
              @title = 'Metrics API'
      Severity: Minor
      Found in lib/bothan/metrics.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

      Method registered has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.registered(app)
      
            app.get '/dashboards' do
              @dashboards = Dashboard.all
              @title = "Dashboards"
      Severity: Major
      Found in lib/bothan/dashboards.rb - About 2 hrs to fix

        File metrics_helpers.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Bothan
          module Helpers
            module Metrics
        
              # pseudo controller functions, ones returning objects, ergo ones grape-entity concerns itself with
        Severity: Minor
        Found in lib/bothan/helpers/metrics_helpers.rb - About 2 hrs to fix

          Function drawTarget has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function drawTarget(value, barcolour, container, datatype) {
            var metrics = {
              actual: {
                data: (value['actual'] / value['annual_target']) * 100,
                name: 'Actual progress'
          Severity: Minor
          Found in lib/public/javascripts/target.js - About 1 hr to fix

            Function validation has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.validation = function(options) {
            
                    var // extend params with defaults
                        settings = $.extend({
                            submit : false,
            Severity: Minor
            Found in docs/js/libs/ui/jquery.validation.js - About 1 hr to fix

              Function buildTable has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function buildTable(row_num, col_num) {
                table = $('#dashboard');
              
                form = $('#metric-template').clone();
                form.removeClass('hidden')
              Severity: Minor
              Found in lib/public/javascripts/dashboard.js - About 1 hr to fix

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

                function populateTable(metrics) {
                  $.each(metrics, function(i, metric) {
                    var table = $('#dashboard');
                
                    var panel = $(table.find('td')[i])
                Severity: Minor
                Found in lib/public/javascripts/dashboard.js - About 1 hr to fix

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

                      function Gumby() {
                          this.$dom = $(document);
                          this.$html = this.$dom.find('html');
                          this.isOldie = !!this.$html.hasClass('oldie');
                          this.click = 'click';
                  Severity: Minor
                  Found in docs/js/libs/gumby.js - About 1 hr to fix

                    Function growCol has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function growCol(td, span, cell_content) {
                      var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
                      var table = td.parents('table')
                      var row = td.closest("tr")
                      var index = td.index()
                    Severity: Minor
                    Found in lib/public/javascripts/dashboard.js - 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 updateSelects has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function updateSelects(table, row_num, col_num) {
                      this.row_num = row_num
                      this.col_num = col_num
                    
                      var self = this
                    Severity: Minor
                    Found in lib/public/javascripts/dashboard.js - About 1 hr to fix

                      Function growRow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function growRow(td, span, cell_content) {
                        var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
                        var row = td.closest("tr")
                        var index = td.index()
                        var old_span = (typeof td.attr('rowspan') === 'undefined') ? 1 : Number(td.attr('rowspan'))
                      Severity: Minor
                      Found in lib/public/javascripts/dashboard.js - About 1 hr to fix

                        Function growCol has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function growCol(td, span, cell_content) {
                          var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
                          var table = td.parents('table')
                          var row = td.closest("tr")
                          var index = td.index()
                        Severity: Minor
                        Found in lib/public/javascripts/dashboard.js - About 1 hr to fix

                          Function growRow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function growRow(td, span, cell_content) {
                            var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
                            var row = td.closest("tr")
                            var index = td.index()
                            var old_span = (typeof td.attr('rowspan') === 'undefined') ? 1 : Number(td.attr('rowspan'))
                          Severity: Minor
                          Found in lib/public/javascripts/dashboard.js - 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 guess_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def guess_type(data)
                                  if data.nil?
                                    'chart'
                                  elsif data[:value].class == String
                                    'chart'
                          Severity: Minor
                          Found in lib/bothan/helpers/metrics_helpers.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 Validation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function Validation($this, req) {
                          
                                  if(Gumby) {
                                      Gumby.debug('Initializing Validation', $this);
                                  }
                          Severity: Minor
                          Found in docs/js/libs/ui/jquery.validation.js - About 1 hr to fix

                            Function ScrollAnimations has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var ScrollAnimations = (function () {
                            
                                //dont do anything if touch is supported (as scroll event wont fire properly)
                                if( Modernizr.touch ) return;
                            
                            
                            Severity: Minor
                            Found in docs/js/theme.js - About 1 hr to fix

                              Function buildMapTiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function buildMapTiles() {
                                var excludes = ['HERE', 'MapBox', 'Thunderforest']
                                for (var provider in L.TileLayer.Provider.providers) {
                                  if (excludes.includes(provider)) continue
                                  if (L.TileLayer.Provider.providers[provider].variants) {
                              Severity: Minor
                              Found in lib/public/javascripts/dashboard.js - About 55 mins 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

                              Severity
                              Category
                              Status
                              Source
                              Language