igorbelo/eagle_search

View on GitHub

Showing 9 of 9 total issues

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

    def mapping
      mapping = { type: type }
      index_settings = @index.settings

      if index_settings[:unsearchable_fields] && (index_settings[:unsearchable_fields].include?(@column.name) || index_settings[:unsearchable_fields].include?(@column.name.to_sym))
Severity: Minor
Found in lib/eagle_search/field.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 build_match_queries has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build_match_queries
      return unless analyzed_properties

      match_queries = []
      analyzed_properties.keys.each do |field_name|
Severity: Minor
Found in lib/eagle_search/interpreter/query.rb - About 1 hr to fix

    Method mapping has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def mapping
          mapping = { type: type }
          index_settings = @index.settings
    
          if index_settings[:unsearchable_fields] && (index_settings[:unsearchable_fields].include?(@column.name) || index_settings[:unsearchable_fields].include?(@column.name.to_sym))
    Severity: Minor
    Found in lib/eagle_search/field.rb - About 1 hr to fix

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

          def build_aggregation(aggregation)
            payload = {}
      
            if terms_aggregation?(aggregation)
              return { aggregation => build_terms_aggregation(aggregation) }
      Severity: Minor
      Found in lib/eagle_search/interpreter/aggregation.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 analysis_settings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def analysis_settings
            default_analysis = {
              filter: {
                eagle_search_shingle_filter: {
                  type: "shingle",
      Severity: Minor
      Found in lib/eagle_search/index.rb - About 1 hr to fix

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

            def payload
              return @options[:custom_payload] if @options[:custom_payload]
        
              payload = {
                query: {
        Severity: Minor
        Found in lib/eagle_search/interpreter.rb - About 1 hr to fix

          Method payload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def payload
                return @options[:custom_payload] if @options[:custom_payload]
          
                payload = {
                  query: {
          Severity: Minor
          Found in lib/eagle_search/interpreter.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 build_match_queries has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def build_match_queries
                return unless analyzed_properties
          
                match_queries = []
                analyzed_properties.keys.each do |field_name|
          Severity: Minor
          Found in lib/eagle_search/interpreter/query.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 generate_payload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def generate_payload(filters)
                payload = {}
          
                filters.each do |key, value|
                  key = key.to_sym
          Severity: Minor
          Found in lib/eagle_search/interpreter/filter.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

          Severity
          Category
          Status
          Source
          Language