hiptest/hiptest-publisher

View on GitHub

Showing 86 of 86 total issues

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

    def call_node_walker(node)
      if node.is_a? Hiptest::Nodes::Node
        @rendered_children = {}

        node.children.each do |name, child| 
Severity: Minor
Found in lib/hiptest-publisher/renderer.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

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

    def check_numeric_list(option_name)
      value = cli_options.send(option_name)
      return if absent?(value)

       value.split(',').each do |val|
Severity: Minor
Found in lib/hiptest-publisher/cli_options_checker.rb and 1 other location - About 35 mins to fix
lib/hiptest-publisher/cli_options_checker.rb on lines 174..180

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

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 check_tag_list(option_name)
      value = cli_options.send(option_name)
      return if absent?(value)

      value.split(',').each do |val|
Severity: Minor
Found in lib/hiptest-publisher/cli_options_checker.rb and 1 other location - About 35 mins to fix
lib/hiptest-publisher/cli_options_checker.rb on lines 164..170

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

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 send_get_request(url, attempt = MAX_REDIRECTION)
      raise MaximumRedirectionReachedError if attempt < 0

      uri = URI.parse(url)
      send_request(Net::HTTP::Get.new(uri))
Severity: Minor
Found in lib/hiptest-publisher/client.rb and 1 other location - About 30 mins to fix
lib/hiptest-publisher/client.rb on lines 253..260

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

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 send_post_request(url, attempt = MAX_REDIRECTION)
      raise MaximumRedirectionReachedError if attempt < 0

      uri = URI.parse(url)
      send_request(Net::HTTP::Post.new(uri))
Severity: Minor
Found in lib/hiptest-publisher/client.rb and 1 other location - About 30 mins to fix
lib/hiptest-publisher/client.rb on lines 244..251

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

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

Avoid too many return statements within this method.
Open

      return display_signature_changed if @cli_options.aw_signature_changed
Severity: Major
Found in lib/hiptest-publisher/formatters/diff_displayer.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return
    Severity: Major
    Found in lib/hiptest-publisher.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return display_definition_changed if @cli_options.aw_definition_changed
      Severity: Major
      Found in lib/hiptest-publisher/formatters/diff_displayer.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return display_renamed if @cli_options.aw_renamed
        Severity: Major
        Found in lib/hiptest-publisher/formatters/diff_displayer.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return
          Severity: Major
          Found in lib/hiptest-publisher.rb - About 30 mins to fix

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

                  def evaluate(value)
                    if value.nil?
                      nil
                    elsif Hiptest::Nodes::Variable === value
                      "<#{value.children[:name]}>"
            Severity: Minor
            Found in lib/hiptest-publisher/node_modifiers/gherkin_adder.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 as_hh_join has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def as_hh_join(context, items, joiner, name, block, else_block = nil)
                  joiner = joiner.to_s
                  joiner.gsub!(/\\t/, "\t")
                  joiner.gsub!(/\\n/, "\n")
            
            
            Severity: Minor
            Found in lib/hiptest-publisher/handlebars_helper.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 find_uniq_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def find_uniq_name(name, existing)
                    return name unless existing.include?(name)
            
                    index = 1
                    new_name = ""
            Severity: Minor
            Found in lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.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 compute_signature_changed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def compute_signature_changed
                  excluded = [
                    @created_uids,
                    @deleted_uids,
                    @definition_changed_uids
            Severity: Minor
            Found in lib/hiptest-publisher/signature_differ.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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def url
                  if cli_options.push?
                    "#{cli_options.site}/import_test_results/#{cli_options.token}/#{cli_options.push_format}#{push_query_parameters}"
                  elsif test_run_id
                    "#{base_publication_path}/test_run/#{test_run_id}#{test_run_export_filter}"
            Severity: Minor
            Found in lib/hiptest-publisher/client.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 needs_fixing? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def needs_fixing?(call)
                  scenario = call.parent
            
                  return false unless scenario.is_a?(Hiptest::Nodes::Scenario)
                  return false unless call.children[:annotation].nil? || ignore_case_equal?(call.children[:annotation], 'then')
            Severity: Minor
            Found in lib/hiptest-publisher/renderer_addons/groovy_spock_addon.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_call_chunks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def set_call_chunks(call)
                    all_arguments = all_valued_arguments_for(call)
                    inline_parameter_names = []
                    extra_inlined_arguments = []
            
            
            Severity: Minor
            Found in lib/hiptest-publisher/node_modifiers/gherkin_adder.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 check_secret_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_secret_token
                  if absent?(cli_options.xml_file)
                    if absent?(cli_options.token)
                      raise CliOptionError, I18n.t('errors.cli_options.missing_token')
                    end
            Severity: Minor
            Found in lib/hiptest-publisher/cli_options_checker.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 compute_renamed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def compute_renamed
                  excluded = [
                    @created_uids,
                    @deleted_uids,
                    @definition_changed_uids,
            Severity: Minor
            Found in lib/hiptest-publisher/signature_differ.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

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

                    if !File.readable?(xml_path)
                      raise CliOptionError, I18n.t('errors.cli_options.unreadable_xml_file', path: cli_options.xml_file)
                    elsif !File.file?(xml_path)
                      raise CliOptionError, I18n.t('errors.cli_options.irregular_xml_file', path: cli_options.xml_file)
                    end
            Severity: Minor
            Found in lib/hiptest-publisher/cli_options_checker.rb and 1 other location - About 20 mins to fix
            lib/hiptest-publisher/cli_options_checker.rb on lines 102..106

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

            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

            Severity
            Category
            Status
            Source
            Language