cantino/huginn

View on GitHub

Showing 141 of 177 total issues

Method grab_config_with_cmd! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def grab_config_with_cmd!(cmd, opts = {})
    config_data = capture(cmd, opts)
    $config = {}
    if config_data !~ /has no config vars/
      config_data.split("\n").map do |line|
Severity: Minor
Found in lib/setup_tools.rb - 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

Method receive_web_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def receive_web_request(request)
      params = request.params.except(:action, :controller, :agent_id, :user_id, :format)
      method = request.method_symbol.to_s
      headers = request.headers

Severity: Minor
Found in app/models/agents/twilio_receive_text_agent.rb - 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

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

    def create
      attrs = agent_params
      if agent = current_user.agents.find_by(id: params[:agent_id])
        # POST /agents/:id/dry_run
        if attrs.present?
Severity: Minor
Found in app/controllers/agents/dry_runs_controller.rb - 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

Method configure_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def configure_params(params)
      params[:chat_id] = interpolated['chat_id']
      params[:disable_notification] =
        interpolated['disable_notification'] if interpolated['disable_notification'].present?
      if params.has_key?(:text)
Severity: Minor
Found in app/models/agents/telegram_agent.rb - 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

Method set_table_sort has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def set_table_sort(sort_options)
    valid_sorts = sort_options[:sorts] or raise ArgumentError.new("You must specify :sorts as an array of valid sort attributes.")
    default = sort_options[:default] || { valid_sorts.first.to_sym => :desc }

    if params[:sort].present?
Severity: Minor
Found in app/controllers/concerns/sortable_table.rb - 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

Method convert_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.convert_string(string, leading_dollarsign_is_jsonpath=false)
    if string == true || string == false
      # there might be empty *_path attributes for boolean defaults
      string
    elsif string[0] == '$' && leading_dollarsign_is_jsonpath
Severity: Minor
Found in lib/liquid_migrator.rb - 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

Method send_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def send_message(options)
    @groups = options[:groups]
    @headline = options[:headline]
    @body = options[:body]

Severity: Minor
Found in app/mailers/system_mailer.rb - 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

Method apply_compiled_matchers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_compiled_matchers(matchers, event, &block)
      return yield if matchers.nil?

      # event.payload.dup does not work; HashWithIndifferentAccess is
      # a source of trouble here.
Severity: Minor
Found in app/models/agents/event_formatting_agent.rb - 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

Avoid deeply nested control flow statements.
Open

                if re && !re.names.include?(index)
                  errors.add(:base, "no named capture #{index.inspect} found in regexp for #{name.inspect})")
                end
Severity: Major
Found in app/models/agents/website_agent.rb - About 45 mins to fix

    Method load_workers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def load_workers
        workers = {}
        @@agents.each do |klass|
          next if @options[:only] && !@options[:only].include?(klass)
          next if @options[:except] && @options[:except].include?(klass)
    Severity: Minor
    Found in lib/agent_runner.rb - About 45 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

    Avoid deeply nested control flow statements.
    Open

                    case details['xpath']
                    when String
                      # ok
                    when nil
                      errors.add(:base,
    Severity: Major
    Found in app/models/agents/website_agent.rb - About 45 mins to fix

      Method validate_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_options
            errors.add(:base,
                       "you need to specify password if user name is set") if options['username'].present? and !options['password'].present?
            errors.add(:base, "you need to specify your jira URL") unless options['jira_url'].present?
            errors.add(:base,
      Severity: Minor
      Found in app/models/agents/jira_agent.rb - About 45 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

      Method agent_type_icon has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def agent_type_icon(agent, agents)
          receiver_count = links_counter_cache(agents)[:links_as_receiver][agent.id] || 0
          control_count  = links_counter_cache(agents)[:control_links_as_controller][agent.id] || 0
          source_count   = links_counter_cache(agents)[:links_as_source][agent.id] || 0
      
      
      Severity: Minor
      Found in app/helpers/agent_helper.rb - About 45 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

      Method validate_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_options
            cred_name = credential_referenced_by_code
            if cred_name
              errors.add(:base,
                         "The credential '#{cred_name}' referenced by code cannot be found") unless credential(cred_name).present?
      Severity: Minor
      Found in app/models/agents/java_script_agent.rb - About 45 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

      Method receive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def receive(incoming_events)
            # if there are too many, dump a bunch to avoid getting rate limited
            if incoming_events.count > 20
              incoming_events = incoming_events.first(20)
            end
      Severity: Minor
      Found in app/models/agents/twitter_publish_agent.rb - About 45 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

      Method build_for_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_for_type(type, user, attributes = {})
            attributes.delete(:type)
      
            if valid_type?(type)
              type.constantize.new(attributes).tap do |instance|
      Severity: Minor
      Found in app/concerns/assignable_types.rb - About 45 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

      Method extract_each has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_each(&block)
            interpolated['extract'].each_with_object(Output.new) { |(name, extraction_details), output|
              if boolify(extraction_details['repeat'])
                values = Repeater.new { |repeater|
                  block.call(extraction_details, repeater)
      Severity: Minor
      Found in app/models/agents/website_agent.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                      rescue StandardError => e
                        errors.add(:base, "invalid regexp for #{name.inspect}: #{e.message}")
      Severity: Major
      Found in app/models/agents/website_agent.rb - About 45 mins to fix

        Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def initialize(data = {})
            super()
        
            case data
            when Array
        Severity: Minor
        Found in lib/location.rb - About 45 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

        Method <=> has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def <=> other
                other = other.array
                @array.each_with_index do |e, i|
                  o = other[i]
                  case cmp = e <=> o || e.to_s <=> o.to_s
        Severity: Minor
        Found in lib/utils.rb - About 45 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