bikeindex/bike_index

View on GitHub
app/services/spam_estimator.rb

Summary

Maintainability
B
4 hrs
Test Coverage
B
82%

Method vowel_frequency_suspiciousness has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

    def vowel_frequency_suspiciousness(str, str_length = nil, str_downlate = nil)
      str_length ||= str.length.to_f
      return 0 if str_length < 4 # 3 letters or less get a pass

      vowel_percent = vowel_ratio(str, str_length) * 100
Severity: Minor
Found in app/services/spam_estimator.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

Avoid deeply nested control flow statements.
Open

        if str_length < 15
          vowel_percent
        elsif str_length < 30
          vowel_percent + 15
        else
Severity: Major
Found in app/services/spam_estimator.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

          elsif vowel_percent > 40
            vowel_percent - 40
          else
            0
    Severity: Major
    Found in app/services/spam_estimator.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status