manuel84/abrupt

View on GitHub

Showing 8 of 10 total issues

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

      def self.set_value(key, schema, ref)
        ref << ":#{key}"
        key_string = '[' + ref.join('][') + ']'
        value = eval "@values#{key_string}" rescue nil
        return unless value
Severity: Minor
Found in lib/abrupt/transformation/base.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 add_individuals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def add_individuals
          datetime = @values['datetime']
          return @result unless datetime
          @values[:name] = ::Abrupt.format_time(datetime)
          super
Severity: Minor
Found in lib/abrupt/transformation/client/page_view.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 set_value has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.set_value(key, schema, ref)
        ref << ":#{key}"
        key_string = '[' + ref.join('][') + ']'
        value = eval "@values#{key_string}" rescue nil
        return unless value
Severity: Minor
Found in lib/abrupt/transformation/base.rb - About 1 hr to fix

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

        def crawl(uri = nil)
          Abrupt.log '.'
          uri ||= @uri.to_str.append_last_slash
          unless @result[uri]
            html = fetch_html(uri)
    Severity: Minor
    Found in lib/abrupt/crawler.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 add_individuals_for_link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def add_individuals_for_link(link)
              link.each do |type, value|
                next unless type && value
                v = value.is_a?(String) ? CGI.escapeHTML(value) : value
                add_data_property type, v, link[:href]
    Severity: Minor
    Found in lib/abrupt/transformation/website/link.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 add_data_properties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def add_data_properties(input)
              input.each do |type, value|
                next unless type && value
                v = value.is_a?(String) ? CGI.escapeHTML(value) : value
                add_data_property type, v
    Severity: Minor
    Found in lib/abrupt/transformation/website/input.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 append_user_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def append_user_data(file)
          return unless file.is_a?(String) && File.exist?(file)
          xml = Hash.from_xml(File.read(file)).deep_symbolize_keys
          xml[:database][:visitor].ensure_to_a.each do |values|
            ip = values[:ip]
    Severity: Minor
    Found in lib/abrupt/converter.rb - About 35 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 uris_with_same_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def uris_with_same_host(uri)
          if @result[uri][:link] && @result[uri][:link]['a']
            @result[uri][:link]['a'].to_a.map do |link|
              link['href'] if same_host?(link['href'])
            end.compact
    Severity: Minor
    Found in lib/abrupt/crawler.rb - About 25 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