slovensko-digital/navody.digital

View on GitHub

Showing 53 of 82 total issues

Method collection_check_boxes has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
Severity: Minor
Found in app/helpers/admin_form_builder.rb - About 45 mins to fix

    Method select has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def select(method, choices = nil, options = {}, html_options = {}, &block)
    Severity: Minor
    Found in app/helpers/admin_form_builder.rb - About 35 mins to fix

      Method select has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def select(method, values, options = {}, html_options = {}, &block)
      Severity: Minor
      Found in app/helpers/app_form_builder.rb - About 35 mins to fix

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

                def email_present?
                  return unless (@current_step == 'email')
        
                  if @email.present?
                    errors.add(:email, 'Zadajte emailovú adresu v platnom tvare, napríklad jan.novak@firma.sk') unless @email.match?(URI::MailTo::EMAIL_REGEXP)
        Severity: Minor
        Found in app/models/apps/or_sr_app/acts_submission/application_form.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 submit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def submit
            return switch_account_callback unless eid_token&.valid? # If token expires meanwhile
        
            if @upvs_submission.submit(eid_token)
              if @upvs_submission.callback_url.present?
        Severity: Minor
        Found in app/controllers/upvs/submissions_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 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

                  return errors.add(:pin, 'Rodné číslo obsahuje neplatný mesiac')
        Severity: Major
        Found in app/models/apps/president_vote_app/application_form.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return errors.add(:pin, 'Rodné číslo obsahuje neplatný mesiac')
          Severity: Major
          Found in app/models/apps/parliament_vote_app/application_form.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

              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

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

                  def current_user
                    if session[:user_id]
                      @__current_user ||= User.find_by(id: session[:user_id])
                    else
                      session[:anonymous_user_uuid] = SecureRandom.uuid unless session[:anonymous_user_uuid] # TODO make sure this is unique
                Severity: Minor
                Found in app/controllers/application_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

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

                        def invalid_date_errors(day_condition: false, month_condition: false, year_condition: false)
                          errors.add(:stakeholder_dob_day, nil) unless day_condition
                          errors.add(:stakeholder_dob_month, nil) unless month_condition
                          errors.add(:stakeholder_dob_year, nil) unless year_condition
                        end
                Severity: Minor
                Found in app/models/apps/or_sr_app/stakeholders_identifiers/application_form.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

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

                        def set_date_of_birth(year: nil, month: nil, day: nil)
                          @dob_day = day.present? ? day.to_i : nil
                          @dob_month = month.present? ? month.to_i : nil
                          @dob_year = year.present? ? year.to_i : nil
                        end
                Severity: Minor
                Found in app/lib/upvs_submissions/forms/fuzs_data.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