slovensko-digital/navody.digital

View on GitHub

Showing 82 of 82 total issues

Method run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def run(listener)
        case step
        when 'start'
          start_step(listener)
        when 'citizenship'
Severity: Minor
Found in app/models/apps/ep_vote_app/application_form.rb - About 1 hr to fix

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

      def create
        if should_put_eid_token_in_session?
          session[:eid_encoded_token] = eid_encoded_token_from_auth
        end
    
    
    Severity: Minor
    Found in app/controllers/sessions_controller.rb - About 1 hr to fix

      Similar blocks of code found in 4 locations. 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: Major
      Found in app/helpers/admin_form_builder.rb and 3 other locations - About 1 hr to fix
      app/helpers/admin_form_builder.rb on lines 2..8
      app/helpers/admin_form_builder.rb on lines 12..18
      app/helpers/admin_form_builder.rb on lines 22..28

      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 58.

      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 4 locations. Consider refactoring.
      Open

        def text_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: Major
      Found in app/helpers/admin_form_builder.rb and 3 other locations - About 1 hr to fix
      app/helpers/admin_form_builder.rb on lines 12..18
      app/helpers/admin_form_builder.rb on lines 22..28
      app/helpers/admin_form_builder.rb on lines 67..73

      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 58.

      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 4 locations. 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: Major
      Found in app/helpers/admin_form_builder.rb and 3 other locations - About 1 hr to fix
      app/helpers/admin_form_builder.rb on lines 2..8
      app/helpers/admin_form_builder.rb on lines 12..18
      app/helpers/admin_form_builder.rb on lines 67..73

      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 58.

      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 4 locations. 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: Major
      Found in app/helpers/admin_form_builder.rb and 3 other locations - About 1 hr to fix
      app/helpers/admin_form_builder.rb on lines 2..8
      app/helpers/admin_form_builder.rb on lines 22..28
      app/helpers/admin_form_builder.rb on lines 67..73

      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 58.

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

              private def place_step(listener)
                if go_back?
                  self.step = 'permanent_resident'
                  listener.render :permanent_resident
                elsif valid?(:place)
        Severity: Minor
        Found in app/models/apps/president_vote_app/application_form.rb - About 1 hr to fix

          Method initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def initialize(cin: nil, json_form_data: nil, form_data: nil, company_municipality: nil,
                                 stakeholder_nationality: nil, stakeholder_identifier: nil, stakeholder_other_identifier: nil, stakeholder_other_identifier_type: nil,
                                 stakeholder_dob_year: nil, stakeholder_dob_month: nil, stakeholder_dob_day: nil, current_stakeholder_index: -1, stakeholder_municipality: nil,
                                 current_step: nil, go_to_summary: false, back: false)
                    @cin = cin

            Method run has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def run(listener)
                    case step
                    when 'start'
                      start_step(listener)
                    when 'place'
            Severity: Minor
            Found in app/models/apps/parliament_vote_app/application_form.rb - About 1 hr to fix

              Method collection_check_boxes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def collection_check_boxes(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 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 run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def run(listener)
                      case step
                      when 'start'
                        start_step(listener)
                      when 'place'
              Severity: Minor
              Found in app/models/apps/president_vote_app/application_form.rb - About 1 hr to fix

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

                      private def delivery_step(listener)
                        if go_back?
                          self.step = 'place'
                          listener.render :place
                        elsif valid?(:delivery)
                Severity: Minor
                Found in app/models/apps/parliament_vote_app/application_form.rb and 1 other location - About 55 mins to fix
                app/models/apps/president_vote_app/application_form.rb on lines 282..299

                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 46.

                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

                      private def delivery_step(listener)
                        if go_back?
                          self.step = 'place'
                          listener.render :place
                        elsif valid?(:delivery)
                Severity: Minor
                Found in app/models/apps/president_vote_app/application_form.rb and 1 other location - About 55 mins to fix
                app/models/apps/parliament_vote_app/application_form.rb on lines 277..294

                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 46.

                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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def select(method, choices = nil, options = {}, html_options = {}, &block)
                    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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def initialize(
                          full_name: nil, cin: nil, foreign: nil, identifier: nil, other_identifier: nil, other_identifier_type: nil,
                          dob_year: nil, dob_month: nil, dob_day: nil,
                          person_formatted_name: nil, person_given_names: nil, person_family_names: nil, person_prefixes: nil, person_postfixes: nil,
                          address_street: nil, address_reg_number: nil, address_building_number: nil, address_postal_code: nil, address_municipality: nil, address_country: nil,
                Severity: Minor
                Found in app/lib/upvs_submissions/forms/fuzs_data.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 pin_is_ok has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      private def pin_is_ok
                        return errors.add(:pin, 'Rodné číslo je pocinná položka') if pin.blank?
                
                        begin
                          pin.to_i
                Severity: Minor
                Found in app/models/apps/president_vote_app/application_form.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 text_field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def text_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 pin_is_ok has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      private def pin_is_ok
                        return errors.add(:pin, 'Rodné číslo je pocinná položka') if pin.blank?
                
                        begin
                          pin.to_i
                Severity: Minor
                Found in app/models/apps/parliament_vote_app/application_form.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 person has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.person(data, with_identifiers: true)
                    <<~PERSON
                      <ns1:Osoba>
                        <ns1:TitulPred>#{data&.prefixes}</ns1:TitulPred>
                        <ns1:Meno>#{data&.given_name}</ns1:Meno>
                Severity: Minor
                Found in app/lib/upvs_submissions/form_builders/fuzs_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

                Severity
                Category
                Status
                Source
                Language