tlopo-ruby/tlopo-cli

View on GitHub
lib/tlopo/cli.rb

Summary

Maintainability
A
25 mins
Test Coverage

Method parse_recursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def parse_recursive(obj, result, stack = [])
      stack << obj['name']
      key = stack.join('::')
      _p = parse_options(obj, result, key)
      _p.order! unless _p.nil?
Severity: Minor
Found in lib/tlopo/cli.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 validate_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def validate_command(command)
      required = %w[name banner class]
      optional = %w[switches subcommands]
      required.each do |e|
        raise "Field '#{e}' is required. received: [#{command.inspect}]" unless command[e]
Severity: Minor
Found in lib/tlopo/cli.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def initialize(opts = {})
      msg = 'Either config or config_file must be specified'
      raise msg unless opts[:config_file] || opts[:config]
      raise msg if opts[:config_file] && opts[:config]
      @cfg = YAML.safe_load(File.read(opts[:config_file])) if opts[:config_file]
Severity: Minor
Found in lib/tlopo/cli.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 parse_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_options(obj, result, key)
      return nil if obj.nil?
      result[key] = {} unless result[key]
      result[key]['class'] = obj['class']
      op = OptionParser.new do |opts|
Severity: Minor
Found in lib/tlopo/cli.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 validate_switch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def validate_switch(switch)
      required = %w[name long desc]
      optional = ['short']
      required.each do |e|
        raise "Field '#{e}' is required. received: [#{switch.inspect}]" unless switch[e]
Severity: Minor
Found in lib/tlopo/cli.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

There are no issues that match your filters.

Category
Status