mezis/fuzzily

View on GitHub

Showing 5 of 5 total issues

Method _bulk_update_fuzzy has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def _bulk_update_fuzzy(_o)
        trigram_class = _o.trigram_class_name.constantize

        supports_bulk_inserts  =
          connection.class.name !~ /sqlite/i ||
Severity: Minor
Found in lib/fuzzily/searchable.rb - About 1 hr to fix

    Method extended has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.extended(by)
          by.singleton_class.class_eval do
            def trigrams_table_name=(custom_name)
              @trigrams_table_name = custom_name
            end
    Severity: Minor
    Found in lib/fuzzily/migration.rb - About 1 hr to fix

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

            def make_field_fuzzily_searchable(field, options={})
              class_variable_defined?(:"@@fuzzily_searchable_#{field}") and return
      
              _o = OpenStruct.new(
                :field                  => field,
      Severity: Minor
      Found in lib/fuzzily/searchable.rb - About 1 hr to fix

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

              def _bulk_update_fuzzy(_o)
                trigram_class = _o.trigram_class_name.constantize
        
                supports_bulk_inserts  =
                  connection.class.name !~ /sqlite/i ||
        Severity: Minor
        Found in lib/fuzzily/searchable.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 make_field_fuzzily_searchable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def make_field_fuzzily_searchable(field, options={})
                class_variable_defined?(:"@@fuzzily_searchable_#{field}") and return
        
                _o = OpenStruct.new(
                  :field                  => field,
        Severity: Minor
        Found in lib/fuzzily/searchable.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