henderea/everyday-cli-utils

View on GitHub

Showing 24 of 24 total issues

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

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

      def add_option_with_param(options, opts, names, opt_name, settings = {})
        opts.on(*names, settings[:type] || String) { |param|
          if settings[:append]
            options[opt_name] << param
          else
Severity: Minor
Found in lib/everyday-cli-utils/option.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 param_option_name_mod has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def param_option_name_mod(names, settings)
        names[0] << ' PARAM' unless names.any? { |v| v.include?(' ') }
        names = settings.has_key?(:desc) ? (names + [settings[:desc]]) : names
        settings.has_key?(:type) ? (names + [settings[:type]]) : names
      end
Severity: Minor
Found in lib/everyday-cli-utils/option.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 param_option_value_determine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def param_option_value_determine(current_value, new_value, settings)
        settings[:append] ? (current_value + new_value) : ((new_value.nil? || new_value == '') ? current_value : new_value)
      end
Severity: Minor
Found in lib/everyday-cli-utils/option.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

Severity
Category
Status
Source
Language