envygeeks/ruby-active_record_mocks

View on GitHub

Showing 4 of 4 total issues

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

      def model_name(mname = nil)
        if setup? || (! mname && @model_name)
          @model_name
        else
          @model_name = mname ? mname : \
Severity: Minor
Found in lib/active_record_mocks/mock/table.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 table_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def table_name(tname = nil)
        if setup? || (! tname && @table_name)
          @table_name
        else
          @table_name = \
Severity: Minor
Found in lib/active_record_mocks/mock/table.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 includes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def includes(*incs)
        if setup? || incs.size == 0
          @includes
        else
          incs.each do |i|
Severity: Minor
Found in lib/active_record_mocks/mock/table.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 parent_class has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parent_class(cname=nil)
        if setup? || (! cname && @parent_class)
          @parent_class
        else
          @parent_class = cname ? cname.to_s.constantize : \
Severity: Minor
Found in lib/active_record_mocks/mock/table.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

Severity
Category
Status
Source
Language