MiraitSystems/enju_trunk

View on GitHub
app/controllers/series_has_manifestations_controller.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method update_all has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def update_all
    respond_to do |format|
      begin
        @current_basket.checked_manifestations.map(&:manifestation).each do |m|
          if m.series_statement
Severity: Minor
Found in app/controllers/series_has_manifestations_controller.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 update_all has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_all
    respond_to do |format|
      begin
        @current_basket.checked_manifestations.map(&:manifestation).each do |m|
          if m.series_statement
Severity: Minor
Found in app/controllers/series_has_manifestations_controller.rb - About 1 hr to fix

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

      def create
        respond_to do |format|
          if @series_has_manifestation.save
            if params[:mode] == 'edit_manifestation'
              format.html { redirect_to edit_manifestation_path(@series_has_manifestation.manifestation) }
    Severity: Minor
    Found in app/controllers/series_has_manifestations_controller.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        respond_to do |format|
          old_series_statement = @series_has_manifestation.series_statement
          if @series_has_manifestation.update_attributes(params[:series_has_manifestation])
            old_series_statement.index
    Severity: Minor
    Found in app/controllers/series_has_manifestations_controller.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

    There are no issues that match your filters.

    Category
    Status