sonots/haikanko

View on GitHub

Showing 32 of 47 total issues

Method generate_output has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_output(count)
    output = {}
    if @aggregate == :all
      c = count['all']
      if c[:num] then output['num'] = c[:num] end
Severity: Minor
Found in pipework/fluentd/server/plugin/out_numeric_monitor.rb - 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 bootstrap-datepicker.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* =========================================================
 * bootstrap-datepicker.js 
 * http://www.eyecon.ro/bootstrap-datepicker
 * =========================================================
 * Copyright 2012 Stefan Petre
Severity: Minor
Found in web/public/js/bootstrap-datepicker.js - About 4 hrs to fix

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

            fill: function() {
                var d = new Date(this.viewDate),
                    year = d.getFullYear(),
                    month = d.getMonth(),
                    currentDate = this.date.valueOf();
    Severity: Major
    Found in web/public/js/bootstrap-datepicker.js - About 2 hrs to fix

      Method emit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def emit(tag, es, chain)
          ntag, targets = @match_cache[tag]
          unless targets
            ntag = tag.sub(@prefix_match, @tag_prefix)
            targets = []
      Severity: Minor
      Found in pipework/fluentd/server/plugin/out_route.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 click has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              click: function(e) {
                  e.stopPropagation();
                  e.preventDefault();
                  var target = $(e.target).closest('span, td, th');
                  if (target.length == 1) {
      Severity: Major
      Found in web/public/js/bootstrap-datepicker.js - About 2 hrs to fix

        Method emit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def emit(tag, es, chain)
            messages = []
            privmsg_messages = []
        
            es.each {|time,record|
        Severity: Minor
        Found in pipework/fluentd/server/plugin/out_ikachan.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 agent_opt_parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def agent_opt_parse
          hostnames = []
          if ENV['LABEL']
            hostnames = Feature.hostnames(ENV['LABEL'].split(","))
            $stderr.puts 'LABEL does not exist' and exit unless hostnames.present?
        Severity: Minor
        Found in pipework/mina/agent.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 receive_lines has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def receive_lines(lines)
            lines.each do |line|
              next if line == ""
              case @line_number
              when 0..1
        Severity: Minor
        Found in pipework/fluentd/server/plugin/in_dstat.rb - About 1 hr to fix

          Method included has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.included(controller)
              controller.helpers do
          
                def h(text)
                  Rack::Utils.escape_html(text)
          Severity: Minor
          Found in web/lib/sinatra_helper.rb - About 1 hr to fix

            Method emit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def emit(tag, es, chain)
                min = nil
                max = nil
                sum = 0
                num = 0
            Severity: Minor
            Found in pipework/fluentd/server/plugin/out_numeric_monitor.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 receive_lines has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def receive_lines(lines)
                lines.each do |line|
                  next if line == ""
                  case @line_number
                  when 0..1
            Severity: Minor
            Found in pipework/fluentd/server/plugin/in_dstat.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 countups has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def countups(tag, min, max, sum, num, sample)
                if @aggregate == :all
                  tag = 'all'
                end
            
            
            Severity: Minor
            Found in pipework/fluentd/server/plugin/out_numeric_monitor.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 generate_output has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def generate_output(count)
                output = {}
                if @aggregate == :all
                  c = count['all']
                  if c[:num] then output['num'] = c[:num] end
            Severity: Minor
            Found in pipework/fluentd/server/plugin/out_numeric_monitor.rb - About 1 hr to fix

              Method emit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def emit(tag, es, chain)
                  messages = []
                  privmsg_messages = []
              
                  es.each {|time,record|
              Severity: Minor
              Found in pipework/fluentd/server/plugin/out_ikachan.rb - About 1 hr to fix

                Method emit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def emit(tag, es, chain)
                    ntag, targets = @match_cache[tag]
                    unless targets
                      ntag = tag.sub(@prefix_match, @tag_prefix)
                      targets = []
                Severity: Minor
                Found in pipework/fluentd/server/plugin/out_route.rb - About 1 hr to fix

                  Method worker_deployed? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def worker_deployed?(hostname)
                      hist = History.find_by(host: hostname, node_type: "worker")
                      if enabled?
                        return false if hist.nil? or hist.deployed_at.nil?
                        hist.deployed_at >= self.updated_at if self.updated_at
                  Severity: Minor
                  Found in models/feature.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 agent_deployed? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def agent_deployed?(hostname)
                      hist = History.find_by(host: hostname, node_type: "agent")
                      if enabled?
                        return false if hist.nil? or hist.deployed_at.nil?
                        hist.deployed_at >= self.agent_updated_at if self.agent_updated_at
                  Severity: Minor
                  Found in models/feature.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 configure has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def configure(conf)
                      super
                  
                      if @remove_prefix
                        @removed_prefix_string = @remove_prefix + '.'
                  Severity: Minor
                  Found in pipework/fluentd/server/plugin/out_hash_forward.rb - About 1 hr to fix

                    Method configure has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def configure(conf)
                        super
                    
                        @channel = '#' + @channel
                        @join_uri = URI.parse "http://#{@host}:#{@port}/join"
                    Severity: Minor
                    Found in pipework/fluentd/server/plugin/out_ikachan.rb - About 1 hr to fix

                      Function Datepicker has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          var Datepicker = function(element, options){
                              this.element = $(element);
                              this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
                              this.picker = $(DPGlobal.template)
                                                  .appendTo('body')
                      Severity: Minor
                      Found in web/public/js/bootstrap-datepicker.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language