hiptest/hiptest-publisher

View on GitHub
lib/hiptest-publisher/options_parser.rb

Summary

Maintainability
F
3 days
Test Coverage

File options_parser.rb has 695 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'i18n'
require 'optparse'
require 'parseconfig'
require 'ostruct'
require 'digest/md5'
Severity: Major
Found in lib/hiptest-publisher/options_parser.rb - About 1 day to fix

    Method update_options has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.update_options(options, reporter)
        config = ParseConfig.new(options.config)
        config.get_params.each do |param|
          next if options.__cli_args && options.__cli_args.include?(param.to_sym)
          if param.start_with?("no_")
    Severity: Minor
    Found in lib/hiptest-publisher/options_parser.rb - About 3 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 all_options has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.all_options
        [
          Option.new('t', 'token=TOKEN', nil, String, I18n.t('options.token'), :token),
          Option.new('l', 'language=LANG', 'ruby', String, I18n.t('options.language'), :language),
          Option.new('f', 'framework=FRAMEWORK', '', String, I18n.t('options.framework'), :framework),
    Severity: Major
    Found in lib/hiptest-publisher/options_parser.rb - About 2 hrs to fix

      Class LanguageGroupConfig has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class LanguageGroupConfig
        @@MAX_FILE_SIZE = 255
      
        def initialize(user_params, language_group_params = nil)
          @output_directory = user_params.output_directory || ""
      Severity: Minor
      Found in lib/hiptest-publisher/options_parser.rb - About 2 hrs to fix

        Method normalize! has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def normalize!(reporter = nil)
            self.uids = true if test_run? && uids_not_set_yet?
            self.no_uids = !uids # silent normalization
            modified_options = self.clone
            if actionwords_only
        Severity: Minor
        Found in lib/hiptest-publisher/options_parser.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 normalize! has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def normalize!(reporter = nil)
            self.uids = true if test_run? && uids_not_set_yet?
            self.no_uids = !uids # silent normalization
            modified_options = self.clone
            if actionwords_only
        Severity: Minor
        Found in lib/hiptest-publisher/options_parser.rb - About 1 hr to fix

          Method make_language_group_config has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def make_language_group_config group_name
              # List of options that can be set in the config file but not in command line
              non_visible_options = {
                package: @cli_options.package,
                meta: meta,
          Severity: Minor
          Found in lib/hiptest-publisher/options_parser.rb - About 1 hr to fix

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

              def node_name
                if self[:node_name] == "tests" || self[:node_name] == "scenarios" || self[:group_name] == "tests"
                  @leafless_export ? :tests : :scenarios
                elsif self[:node_name] == "actionwords" || self[:group_name] == "actionwords"
                  :actionwords
            Severity: Minor
            Found in lib/hiptest-publisher/options_parser.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 config_path_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.config_path_for(cli_options)
                config_name = if cli_options.framework.empty?
                                "#{cli_options.language}.conf"
                              else
                                "#{cli_options.language}-#{cli_options.framework}.conf"
            Severity: Minor
            Found in lib/hiptest-publisher/options_parser.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 register_partials has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def register_partials
                dirs.reverse_each do |path|
                  next unless File.directory?(path)
                  Dir.entries(path).select do |file_name|
                    file_path = File.join(path, file_name)
            Severity: Minor
            Found in lib/hiptest-publisher/options_parser.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 show_languages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.show_languages
                puts I18n.t('help.languages.supported_languages')
                languages.each do |language, frameworks|
                  puts "#{language}:"
                  if frameworks.empty?
            Severity: Minor
            Found in lib/hiptest-publisher/options_parser.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def initialize(short, long, default, type, help, attribute)
            Severity: Minor
            Found in lib/hiptest-publisher/options_parser.rb - About 45 mins to fix

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

                def make_language_group_config group_name
                  # List of options that can be set in the config file but not in command line
                  non_visible_options = {
                    package: @cli_options.package,
                    meta: meta,
              Severity: Minor
              Found in lib/hiptest-publisher/options_parser.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

              There are no issues that match your filters.

              Category
              Status