henderea/everyday-cli-utils

View on GitHub

Showing 24 of 24 total issues

File option.rb has 372 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative 'safe/maputil'
require 'optparse'
require 'yaml'

module EverydayCliUtils
Severity: Minor
Found in lib/everyday-cli-utils/option.rb - About 4 hrs to fix

    Method register has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def register(order, opts, options, opt_name, names, exit_on_action, print_on_exit_str, settings, default_settings, action_block, pre_parse_block = nil)
    Severity: Major
    Found in lib/everyday-cli-utils/option.rb - About 1 hr to fix

      Method run_nmeans has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.run_nmeans(avg, cnt, collection, ft, ft1, ft2, ks, ks1, max_k, threshold)
      Severity: Major
      Found in lib/everyday-cli-utils/safe/kmeans.rb - About 1 hr to fix

        Method register_special has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def register_special(order, opt_name, names, exit_on_action, print_on_exit_str, settings, action_block, pre_parse_block = nil)
        Severity: Major
        Found in lib/everyday-cli-utils/option.rb - About 1 hr to fix

          Method register has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def register(opts, options, type, opt_name, names, settings = {}, default_settings = {}, &block)
          Severity: Major
          Found in lib/everyday-cli-utils/option.rb - About 1 hr to fix

            Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def initialize(order, exit_on_action, names, print_on_exit_str, settings, action_block, pre_parse_block = nil)
            Severity: Major
            Found in lib/everyday-cli-utils/option.rb - About 50 mins to fix

              Method run_nmean has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def self.run_nmean(collection, avg, cnt, ft, ft2, k, ks)
              Severity: Major
              Found in lib/everyday-cli-utils/safe/kmeans.rb - About 50 mins to fix

                Method defaults_options_helper has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def defaults_options_helper(file_path, names, settings, order, opt_name, print_on_exit_string, composite_name)
                Severity: Major
                Found in lib/everyday-cli-utils/option.rb - About 50 mins to fix

                  Method method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def method_missing(method, *args)
                      name   = method.to_s
                      colors = 'black|red|green|yellow|blue|purple|cyan|white|none'
                      if (name =~ /format(_bold)?(_underline)?(?:_fg_(#{colors}))?(?:_bg_(#{colors}))?/).nil?
                        old_method_missing(method, *args)
                  Severity: Minor
                  Found in lib/everyday-cli-utils/format.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 format_all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self::format_all(text)
                        colors    = 'bk|rd|gr|yw|bl|pu|cy|wh|no'
                        color_map = { 'bk' => :black, 'rd' => :red, 'gr' => :green, 'yw' => :yellow, 'bl' => :blue, 'pu' => :purple, 'cy' => :cyan, 'wh' => :white, 'no' => :none }
                        regex     = /\{(.+?)\}\((bd)?(ul)?(?:f(#{colors}))?(?:b(#{colors}))?\)/
                        regex2    = /\{(.+?)\}\(:(.+?)\)/
                  Severity: Minor
                  Found in lib/everyday-cli-utils/safe/format.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 add_averages has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def self.add_averages(height, ks, lines, mi, step, width)
                  Severity: Minor
                  Found in lib/everyday-cli-utils/safe/histogram.rb - About 45 mins to fix

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

                        def show_info_helper(names, settings, order, opt_name, exit_on_sym, &block)
                    Severity: Minor
                    Found in lib/everyday-cli-utils/option.rb - About 45 mins to fix

                      Method param_option_value_transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def param_option_value_transform(new_value, settings)
                              new_value.is_a?(Array) ? (settings[:append] ? new_value : new_value[0]) : (settings[:append] ? [new_value] : new_value)
                            end
                      Severity: Minor
                      Found in lib/everyday-cli-utils/option.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 add_option_with_param has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def add_option_with_param(options, opts, names, opt_name, settings = {})
                      Severity: Minor
                      Found in lib/everyday-cli-utils/option.rb - About 35 mins to fix

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

                              def add_option(options, opts, names, opt_name, settings = {})
                        Severity: Minor
                        Found in lib/everyday-cli-utils/option.rb - About 35 mins to fix

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

                              def self.add_graph(counts, height, lines, max_y, width)
                          Severity: Minor
                          Found in lib/everyday-cli-utils/safe/histogram.rb - About 35 mins to fix

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

                                def register(type, opt_name, names, settings = {}, &block)
                            Severity: Minor
                            Found in lib/everyday-cli-utils/option.rb - About 35 mins to fix

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

                                def call_override_at_index(overrides, ind, ovin, args, &block)
                              Severity: Minor
                              Found in lib/everyday-cli-utils/override.rb - About 35 mins to fix

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

                                      def def_type(type, default_value_block, value_determine_block, name_mod_block = nil, value_transform_block = nil)
                                Severity: Minor
                                Found in lib/everyday-cli-utils/option.rb - About 35 mins to fix

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

                                      def val_to_str(val)
                                        if val.nil?
                                          'nil'
                                        elsif val.is_a?(TrueClass)
                                          'true'
                                  Severity: Minor
                                  Found in lib/everyday-cli-utils/option.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