slovensko-digital/navody.digital

View on GitHub
app/controllers/apps/or_sr_app/stakeholders_identifiers_controller.rb

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Class StakeholdersIdentifiersController has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class Apps::OrSrApp::StakeholdersIdentifiersController < ApplicationController
  before_action :load_application_form, only: [:stakeholder_identifier, :xml_form, :generate_xml_form]
  before_action :set_metadata, only: [:subject_selection]

  rescue_from OrSrRecordFetcher::OrsrRecordError, UpvsSubmissions::Forms::FuzsData::FuzsError, StandardError, :with => :handle_error
Severity: Minor
Found in app/controllers/apps/or_sr_app/stakeholders_identifiers_controller.rb - About 2 hrs to fix

    Method stakeholder_identifier has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def stakeholder_identifier
        (render action: :subject_selection and return) if @application_form.corporate_body_invalid?
    
        if currently_showing_company_address?
          update_company_address
    Severity: Minor
    Found in app/controllers/apps/or_sr_app/stakeholders_identifiers_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 next_step has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def next_step
        redirect_to action: :unsupported and return unless @application_form.form_data&.sro?
        redirect_to action: :nothing_missing and return if @application_form.form_data&.all_stakeholders_ok?
    
        if @application_form.go_back?

    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 next_step has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def next_step
        redirect_to action: :unsupported and return unless @application_form.form_data&.sro?
        redirect_to action: :nothing_missing and return if @application_form.form_data&.all_stakeholders_ok?
    
        if @application_form.go_back?

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

        def load_municipality_options(data)
          return [] unless data
      
          if data&.with_missing_municipality_identifier?
            @municipality_options = data&.address&.municipality_code_list.map{|m| m.value}
      Severity: Minor
      Found in app/controllers/apps/or_sr_app/stakeholders_identifiers_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

      Avoid too many return statements within this method.
      Open

              render :stakeholder_identifier and return
      Severity: Major
      Found in app/controllers/apps/or_sr_app/stakeholders_identifiers_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  render :subject_selection and return
        Severity: Major
        Found in app/controllers/apps/or_sr_app/stakeholders_identifiers_controller.rb - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status