skroutz/string_metric

View on GitHub

Showing 13 of 13 total issues

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

      def self.distance(from, to, options = {})
        max_distance      = options[:max_distance]
        insertion_cost    = options[:insertion_cost]    || 1
        deletion_cost     = options[:deletion_cost]     || 1
        substitution_cost = options[:substitution_cost] || 1

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 distance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def self.distance(from, to, options = {})
        max_distance      = options[:max_distance]
        insertion_cost    = options.fetch(:insertion_cost, 1)
        deletion_cost     = options.fetch(:deletion_cost, 1)
        substitution_cost = options.fetch(:substitution_cost, 1)
Severity: Minor
Found in lib/string_metric/levenshtein/iterative_with_two_matrix_rows.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 distance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def self.distance(from, to, options = {})
        max_distance      = options[:max_distance]
        insertion_cost    = options.fetch(:insertion_cost, 1)
        deletion_cost     = options.fetch(:deletion_cost, 1)
        substitution_cost = options.fetch(:substitution_cost, 1)
Severity: Minor
Found in lib/string_metric/levenshtein/recursive.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 distance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def self.distance(from, to, options = {})
        max_distance      = options[:max_distance]
        insertion_cost    = options.fetch(:insertion_cost, 1)
        deletion_cost     = options.fetch(:deletion_cost, 1)
        substitution_cost = options.fetch(:substitution_cost, 1)
Severity: Minor
Found in lib/string_metric/levenshtein/iterative_with_full_matrix.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 distance has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.distance(from, to, options = {})
        max_distance      = options[:max_distance]
        insertion_cost    = options[:insertion_cost]    || 1
        deletion_cost     = options[:deletion_cost]     || 1
        substitution_cost = options[:substitution_cost] || 1

    Method distance has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.distance(from, to, options = {})
            max_distance      = options[:max_distance]
            insertion_cost    = options.fetch(:insertion_cost, 1)
            deletion_cost     = options.fetch(:deletion_cost, 1)
            substitution_cost = options.fetch(:substitution_cost, 1)
    Severity: Minor
    Found in lib/string_metric/levenshtein/iterative_with_full_matrix.rb - About 1 hr to fix

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

            def self.distance(from, to, options = {})
              max_distance      = options[:max_distance]
              insertion_cost    = options.fetch(:insertion_cost, 1)
              deletion_cost     = options.fetch(:deletion_cost, 1)
              substitution_cost = options.fetch(:substitution_cost, 1)
      Severity: Minor
      Found in lib/string_metric/levenshtein/iterative_with_two_matrix_rows.rb - About 1 hr to fix

        Method distance has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.distance(from, to, options = {})
                max_distance      = options[:max_distance]
                insertion_cost    = options.fetch(:insertion_cost, 1)
                deletion_cost     = options.fetch(:deletion_cost, 1)
                substitution_cost = options.fetch(:substitution_cost, 1)
        Severity: Minor
        Found in lib/string_metric/levenshtein/recursive.rb - About 1 hr to fix

          Method distance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.distance(from, to, options = {})
                  max_distance      = options[:max_distance]
                  insertion_cost    = options[:insertion_cost]    || 1
                  deletion_cost     = options[:deletion_cost]     || 1
                  substitution_cost = options[:substitution_cost] || 1
          Severity: Minor
          Found in lib/string_metric/levenshtein/iterative_with_two_matrix_rows_ext.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 searchRecursive has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def self.searchRecursive(node, letter, word, previousRow, results)
          Severity: Minor
          Found in lib/string_metric/levenshtein/trie_radix_tree.rb - About 35 mins to fix

            Method searchRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.searchRecursive(node, letter, word, previousRow, results)
                    columns = word.length + 1
                    currentRow = [previousRow[0] + 1]
            
                    (1...columns).each do |column|
            Severity: Minor
            Found in lib/string_metric/levenshtein/trie_radix_tree.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

            Avoid too many return statements within this method.
            Open

                      return [distance(from.chop, to, options) + deletion_cost,
                              distance(from, to.chop, options) + insertion_cost,
                              distance(from.chop, to.chop, options) + cost,
                              max_distance
                             ].min
            Severity: Major
            Found in lib/string_metric/levenshtein/recursive.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return [distance(from.chop, to, options) + deletion_cost,
                                distance(from, to.chop, options) + insertion_cost,
                                distance(from.chop, to.chop, options) + cost
                               ].min
              Severity: Major
              Found in lib/string_metric/levenshtein/recursive.rb - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language