hyperoslo/feeder

View on GitHub

Showing 4 of 4 total issues

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

  def _create_feeder_item
    condition = self.class.feedable_options.try(:[], :if)

    if condition
      if condition.respond_to? :call
Severity: Minor
Found in lib/feeder/concerns/feedable.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

Method vote has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def vote(item, method)
        if can_like? item
          if params[:like_scope]
            if valid_like_scope? params[:like_scope]
              item.send(method, voter: liker, vote_scope: params[:like_scope])
Severity: Minor
Found in lib/feeder/concerns/controllers/items_controller.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 _update_feeder_item has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def _update_feeder_item
    if feeder_item
      feeder_item.touch
      if respond_to? :sticky
        feeder_item.sticky = sticky
Severity: Minor
Found in lib/feeder/concerns/feedable.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 report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def report(reporter = nil)
        if reporter
          return if reported_by?(reporter)
          reports.create! reporter: reporter
        else
Severity: Minor
Found in lib/feeder/concerns/models/item.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

Severity
Category
Status
Source
Language