andrab/ecuacovid

View on GitHub

Showing 12 of 29 total issues

Method register_compound_tasks has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def register_compound_tasks
      desc "Saves city positive cases pivoted"
      task generate_positives_cities_tabulated: [
        :positives_cities_accumulated_per_day_tabulated,
        :positives_cities_new_per_day_tabulated,
Severity: Major
Found in lib/ecuacovid/tasks.rb - About 3 hrs to fix

    Method prepare has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def prepare(query)
          plan = query.compile
    
          Class.new do
            define_method :pull do
    Severity: Minor
    Found in lib/ecuacovid/data/local_fast_store.rb - About 1 hr to fix

      Method rest has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def rest(datasets, options)
            columns = options[:columns] || []
            keep = options[:keep] || []
            keys = columns + keep
      
      
      Severity: Minor
      Found in lib/ecuacovid/table_math.rb - About 1 hr to fix

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

            def rest(datasets, options)
              columns = options[:columns] || []
              keep = options[:keep] || []
              keys = columns + keep
        
        
        Severity: Minor
        Found in lib/ecuacovid/table_math.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 prepare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def prepare(query)
              plan = query.compile
        
              Class.new do
                define_method :pull do
        Severity: Minor
        Found in lib/ecuacovid/data/local_fast_store.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 rename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def rename(names, replacements)
              return [] if names.nil?
        
              new_names = replacements[:rename] || {}
              new_names.empty? ? names : (!names.is_a?(Array) ? [names] : names).map {|name| new_names[name] || name}.compact
        Severity: Minor
        Found in lib/ecuacovid/table.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 rename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def rename(names, replacements)
                return [] if names.nil?
            
                new_names = replacements[:rename] || {}
                new_names.empty? ? names : (!names.is_a?(Array) ? [names] : names).map {|name| new_names.fetch(name, name)}
        Severity: Minor
        Found in lib/ecuacovid/nu_table.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 construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def construct(datum, options={})
              grouped        = group(datum, options[:by] || DEFAULT_DATE)
              subtables      = split_into_subtables(grouped, options[:target])
        
              dates          = tags(grouped, options)
        Severity: Minor
        Found in lib/ecuacovid/table_math.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 headers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def headers(options={})
                headers  = rename(options[:headers], options)
                headers << rename(options[:column_names], options) unless default?(options)
                headers << rename(options[:keep], options) if default?(options)
                headers << rename(options[:new] || options[:eval], options) unless tabulated?(options)
        Severity: Minor
        Found in lib/ecuacovid/nu_table.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

        Method headers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def headers(options={})
              cols  = rename(options[:headers], options)
              cols << rename(options[:column_names], options) unless default?(options)
              cols << rename(options[:keep], options) if default?(options)
              cols << rename(options[:new] || options[:eval], options) unless tabulated?(options)
        Severity: Minor
        Found in lib/ecuacovid/table.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

        Method mortalities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def mortalities
              @model = :mortalities
              @years = @filters.select {|(field, op, value)| field == :year && op == :eq}
        
              @includes = @filters.select {|(field, op, value)| op == :in && field == :year}
        Severity: Minor
        Found in lib/ecuacovid/data.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

        Method positives has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def positives
              @model = :positives
              @years = @filters.select {|(field, op, value)| field == :year && op == :eq}
        
              @includes = @filters.select {|(field, op, value)| op == :in && field == :year}
        Severity: Minor
        Found in lib/ecuacovid/data.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