sxross/MotionModel

View on GitHub
motion/ext.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method reset has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def reset
    # Put singular-form to plural form transformations here
    @plurals = [
      [/^person$/, 'people'],
      [/^man$/, 'men'],
Severity: Major
Found in motion/ext.rb - About 3 hrs to fix

    File ext.rb has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class String
      unless String.instance_methods.include?(:humanize)
        def humanize
          self.split(/_|-| /).join(' ')
        end
    Severity: Minor
    Found in motion/ext.rb - About 3 hrs to fix

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

        def inflect(word, direction) #nodoc
          return word if uncountable?(word)
      
          subject = word.dup
      
      
      Severity: Minor
      Found in motion/ext.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

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

          def camelize(uppercase_first_letter = true)
            string = self.dup
            string.gsub!(/(?:_|(\/))([a-z\d]*)/i) do
              new_word = $2.downcase
              new_word[0] = new_word[0].upcase
      Severity: Minor
      Found in motion/ext.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

      Method put_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def put_message(type, message, color = Ansi.reset_color)
            open_color = @@colorize ? color : ''
            close_color = @@colorize ? Ansi.reset_color : ''
      
            NSLog("#{open_color}#{type} #{caller[1]}: #{message}#{close_color}") unless @@silent
      Severity: Minor
      Found in motion/ext.rb - About 25 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

      There are no issues that match your filters.

      Category
      Status