estimancy/projestimate

View on GitHub
app/controllers/views_widgets_controller.rb

Summary

Maintainability
D
1 day
Test Coverage

Method update has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    authorize! :manage_estimation_widgets, @project

    @views_widget = ViewsWidget.find(params[:id])
    @view_id = @views_widget.view_id
Severity: Minor
Found in app/controllers/views_widgets_controller.rb - About 4 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 create has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    authorize! :manage_estimation_widgets, @project

    # Add the position_x and position_y to params
    @view_id = params[:views_widget][:view_id]
Severity: Minor
Found in app/controllers/views_widgets_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 has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update
    authorize! :manage_estimation_widgets, @project

    @views_widget = ViewsWidget.find(params[:id])
    @view_id = @views_widget.view_id
Severity: Major
Found in app/controllers/views_widgets_controller.rb - About 2 hrs to fix

    Method create has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        authorize! :manage_estimation_widgets, @project
    
        # Add the position_x and position_y to params
        @view_id = params[:views_widget][:view_id]
    Severity: Major
    Found in app/controllers/views_widgets_controller.rb - About 2 hrs to fix

      Method edit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def edit
          authorize! :manage_estimation_widgets, @project
      
          @views_widget = ViewsWidget.find(params[:id])
          @view_id = @views_widget.view_id
      Severity: Minor
      Found in app/controllers/views_widgets_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_view_widget_positions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def update_view_widget_positions
          views_widgets = params[:views_widgets]
          unless views_widgets.empty?
            views_widgets.each_with_index do |element, index|
              view_widget_hash = element.last
      Severity: Minor
      Found in app/controllers/views_widgets_controller.rb - About 55 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 destroy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def destroy
          @views_widget = ViewsWidget.find(params[:id])
          current_view = @views_widget.view
          pemodule_id = current_view.pemodule_id
          @module_project = @views_widget.module_project
      Severity: Minor
      Found in app/controllers/views_widgets_controller.rb - About 55 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