slovensko-digital/navody.digital

View on GitHub

Showing 82 of 82 total issues

Method text_area has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def text_area(method, options={})
    has_errors = @object.errors[method].any?

    @template.content_tag(:div, class: 'govuk-form-group' + (has_errors ? ' govuk-form-group--error' : '')) do
      @template.label(:label, method, class: 'govuk-label') +
Severity: Minor
Found in app/helpers/admin_form_builder.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 date_field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def date_field(method, options={})
    has_errors = @object.errors[method].any?

    @template.content_tag(:div, class: 'govuk-form-group' + (has_errors ? ' govuk-form-group--error' : '')) do
      @template.label(:label, method, class: 'govuk-label') +
Severity: Minor
Found in app/helpers/admin_form_builder.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 collection_select has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
    has_errors = @object.errors[method].any?

    @template.content_tag(:div, class: 'govuk-form-group' + (has_errors ? ' govuk-form-group--error' : '')) do
      @template.label(:label, method, class: 'govuk-label') +
Severity: Minor
Found in app/helpers/admin_form_builder.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 number_field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def number_field(method, options = {})
    has_errors = @object.errors[method].any?

    @template.content_tag(:div, class: 'govuk-form-group' + (has_errors ? ' govuk-form-group--error' : '')) do
      @template.label(:label, method, class: 'govuk-label') +
Severity: Minor
Found in app/helpers/admin_form_builder.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 fill_submission has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def fill_submission
        (render action: :index and return) if @application_form.corporate_body_invalid?

        if @application_form.go_back?
          case @application_form.current_step
Severity: Minor
Found in app/controllers/apps/acts_or_sr_app/acts_submissions_controller.rb - About 45 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 stakeholder_deposit_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.stakeholder_deposit_data(table)
    names = []
    deposit = []

    deposits_line = false
Severity: Minor
Found in app/lib/or_sr_record_fetcher.rb - About 45 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 collection_select has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def collection_select(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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def initialize(street: nil, number: nil, building_number: nil, reg_number: nil, original_municipality: nil, municipality: nil, originally_missing_municipality_id: nil, postal_code: nil, country: nil)
              @street = street
              registration_number = (reg_number != 0 ? reg_number : nil)
              @number = number.present? ? number : join_numbers(building_number, registration_number)
              @postal_code = postal_code
    Severity: Minor
    Found in app/lib/upvs_submissions/forms/fuzs_data.rb - About 45 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 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        def seed_municipalities(file_path: build_file_path('municipalities.csv'), forced_update: false)
          CodeList::Municipality.destroy_all if forced_update
          
          CSV.foreach(file_path, headers: true, col_sep: ',') do |municipality|
            CodeList::Municipality.find_or_create_by({
      Severity: Minor
      Found in app/jobs/seed_code_lists_job.rb and 1 other location - About 45 mins to fix
      app/jobs/seed_code_lists_job.rb on lines 24..31

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 39.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        def seed_countries(file_path: build_file_path('countries.csv'), forced_update: false)
          CodeList::Country.destroy_all if forced_update
      
          CSV.foreach(file_path, headers: true, col_sep: '|') do |country|
            CodeList::Country.find_or_create_by({
      Severity: Minor
      Found in app/jobs/seed_code_lists_job.rb and 1 other location - About 45 mins to fix
      app/jobs/seed_code_lists_job.rb on lines 13..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 39.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            private def sk_citizen_step(listener)
              if go_back?
                self.step = 'start'
                listener.render :start
              elsif valid?(:sk_citizen)
      Severity: Minor
      Found in app/models/apps/president_vote_app/application_form.rb and 2 other locations - About 40 mins to fix
      app/models/apps/parliament_vote_app/application_form.rb on lines 222..236
      app/models/apps/president_vote_app/application_form.rb on lines 232..246

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 37.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            private def permanent_resident_step(listener)
              if go_back?
                self.step = 'sk_citizen'
                listener.render :sk_citizen
              elsif valid?(:permanent_resident)
      Severity: Minor
      Found in app/models/apps/president_vote_app/application_form.rb and 2 other locations - About 40 mins to fix
      app/models/apps/parliament_vote_app/application_form.rb on lines 222..236
      app/models/apps/president_vote_app/application_form.rb on lines 215..229

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 37.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            private def sk_citizen_step(listener)
              if go_back?
                self.step = 'start'
                listener.render :start
              elsif valid?(:sk_citizen)
      Severity: Minor
      Found in app/models/apps/parliament_vote_app/application_form.rb and 2 other locations - About 40 mins to fix
      app/models/apps/president_vote_app/application_form.rb on lines 215..229
      app/models/apps/president_vote_app/application_form.rb on lines 232..246

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 37.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            def find_callback_step_by_path(callback_step_path)
              route = Rails.application.routes.recognize_path(callback_step_path)
              return nil if route < { controller: 'steps', action: 'show' }
          
              Step.where(slug: route[:id]).joins(:journey).where(journey: { slug: route[:journey_id] }).first
          Severity: Minor
          Found in app/controllers/upvs/submissions_controller.rb and 1 other location - About 35 mins to fix
          app/controllers/submissions_controller.rb on lines 74..78

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            def find_callback_step_by_path(callback_step_path)
              route = Rails.application.routes.recognize_path(callback_step_path)
              return nil if route < { controller: 'steps', action: 'show' }
          
              Step.where(slug: route[:id]).joins(:journey).where(journey: { slug: route[:journey_id] }).first
          Severity: Minor
          Found in app/controllers/submissions_controller.rb and 1 other location - About 35 mins to fix
          app/controllers/upvs/submissions_controller.rb on lines 61..65

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                def citizenship_step(listener)
                  if go_back?
                    listener.render :start
                  elsif valid?(:citizenship)
                    case citizenship
          Severity: Minor
          Found in app/models/apps/ep_vote_app/application_form.rb and 1 other location - About 35 mins to fix
          app/models/apps/ep_vote_app/application_form.rb on lines 254..268

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 35.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          Severity
          Category
          Status
          Source
          Language