meducation/inquisitio

View on GitHub

Showing 7 of 9 total issues

Method constantize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def constantize
    names = self.split('::')
    names.shift if names.empty? || names.first.empty?

    names.inject(Object) do |constant, name|
Severity: Minor
Found in lib/inquisitio/active_support.rb - About 3 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 build_query has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def build_query(terms, named_fields)
      return terms.first if is_simple?(terms, named_fields)
      query_blocks = []
      query_blocks << '(and' unless terms.empty? || named_fields.empty?

Severity: Minor
Found in lib/inquisitio/search_url_builder.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

Class Searcher has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Searcher

    def self.method_missing(name, *args)
      Searcher.new.send(name, *args)
    end
Severity: Minor
Found in lib/inquisitio/searcher.rb - About 2 hrs to fix

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

        def build
          components = []
          components << 'q=' + CGI::escape(build_query(@query_terms, @query_named_fields))
          if !@filter_query_terms.empty? || !@filter_query_named_fields.empty?
            components << 'fq=' + CGI::escape(build_query(@filter_query_terms, @filter_query_named_fields))
    Severity: Minor
    Found in lib/inquisitio/search_url_builder.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 filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def filter(value)
          clone do |s|
            if value.nil?
              s.params[:filter_query_terms] = []
              s.params[:filter_query_named_fields] = {}
    Severity: Minor
    Found in lib/inquisitio/searcher.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 where has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def where(value)
          clone do |s|
            if value.is_a?(Array)
              s.params[:query_terms] += value
            elsif value.is_a?(Hash)
    Severity: Minor
    Found in lib/inquisitio/searcher.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(items, current_page, results_per_page, total_count, time_ms)
    Severity: Minor
    Found in lib/inquisitio/results.rb - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language