publiclab/plots2

View on GitHub
app/controllers/home_controller.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method activity has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def activity
    blog = Tag.find_nodes_by_type('blog', 'note', 1).first
    # remove "classroom" postings; also switch to an EXCEPT operator in sql, see https://github.com/publiclab/plots2/issues/375
    hidden_nids = Node.hidden_response_node_ids
    notes = Node.where(type: 'note')
Severity: Major
Found in app/controllers/home_controller.rb - About 2 hrs to fix

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

  def activity
    blog = Tag.find_nodes_by_type('blog', 'note', 1).first
    # remove "classroom" postings; also switch to an EXCEPT operator in sql, see https://github.com/publiclab/plots2/issues/375
    hidden_nids = Node.hidden_response_node_ids
    notes = Node.where(type: 'note')
Severity: Minor
Found in app/controllers/home_controller.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

Extra empty line detected at method body end.
Open


  end
Severity: Minor
Found in app/controllers/home_controller.rb by rubocop

This cops checks if empty lines exist around the bodies of methods.

Example:

# good

def foo
  # ...
end

# bad

def bar

  # ...

end

There are no issues that match your filters.

Category
Status