nicholasjackson/minke

View on GitHub
lib/minke/config/reader.rb

Summary

Maintainability
C
1 day
Test Coverage

Method read_task_section has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def read_task_section section, docker_config
        Task.new.tap do |t|
          t.consul_loader = read_consul_loader_section section['consul_loader']  unless section['consul_loader'] == nil
          t.health_check  = read_url section['health_check']                     unless section['health_check'] == nil
          t.docker        = read_docker_section section['docker']                unless section['docker'] == nil
Severity: Minor
Found in lib/minke/config/reader.rb - About 2 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 read has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def read config_file
        b = binding

        config = Config.new
        file   = ERB.new(File.read(config_file)).result b
Severity: Minor
Found in lib/minke/config/reader.rb - About 2 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 read_docker_registry has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def read_docker_registry section
        DockerRegistrySettings.new.tap do |d|
          d.url       = section['url'].is_a?(Hash) ? read_secure(section['url']) : section['url']
          d.user      = section['user'].is_a?(Hash) ? read_secure(section['user']) : section['user']
          d.password  = section['password'].is_a?(Hash) ? read_secure(section['password']) : section['password']
Severity: Minor
Found in lib/minke/config/reader.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 read_docker_section has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def read_docker_section section
        DockerSettings.new.tap do |d|
          d.build_image              = section['build_image']              unless section['build_image'] == nil
          d.build_docker_file        = section['build_docker_file']        unless section['build_docker_file'] == nil
          d.application_docker_file  = section['application_docker_file']  unless section['application_docker_file'] == nil
Severity: Minor
Found in lib/minke/config/reader.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 read_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def read_url section
        URL.new.tap do |url|
          url.address  = section['address']
          url.port     = section['port']     != nil ? section['port'].to_s : '80'
          url.path     = section['path']     != nil ? section['path'] : ''
Severity: Minor
Found in lib/minke/config/reader.rb - About 55 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 read_pre_post_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def read_pre_post_section section
        TaskRunSettings.new.tap do |tr|
          tr.tasks         = section['tasks']                  unless section['tasks'] == nil
          tr.copy          = read_copy_section section['copy'] unless section['copy'] == nil
        end
Severity: Minor
Found in lib/minke/config/reader.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