razor-x/config_curator

View on GitHub

Showing 7 of 7 total issues

Method create_unit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def create_unit(type, attributes: {})
      "#{self.class.name.split('::').first}::#{type.to_s.camelize}".constantize
        .new(options: unit_options, logger: logger).tap do |unit|
        {src: :source, dst: :destination}.each do |k, v|
          unit.send "#{v}=".to_sym, attributes[k] unless attributes[k].nil?
Severity: Minor
Found in lib/config_curator/collection.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 search_for_host_specific_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def search_for_host_specific_file(path)
      directory = File.dirname path
      filename = File.basename path
      extension = File.extname path
      basename = filename.chomp(extension)
Severity: Minor
Found in lib/config_curator/units/config_file.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 install_component has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def install_component
      if (backend != :stdlib && command?('rsync')) || backend == :rsync
        FileUtils.mkdir_p destination_path
        cmd = [command?('rsync'), '-rtc', '--del', '--links', "#{source_path}/", destination_path]
        logger.debug { "Running command: #{cmd.join ' '}" }
Severity: Minor
Found in lib/config_curator/units/component.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 install has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def install(manifest = 'manifest.yml')
      unless File.exist? manifest
        logger.fatal { "Manifest file '#{manifest}' does not exist." }
        return false
      end
Severity: Minor
Found in lib/config_curator/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 set_mode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def set_mode
      chmod = command? 'chmod'
      find = command? 'find'

      return unless chmod && find
Severity: Minor
Found in lib/config_curator/units/component.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 install has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def install
      return false unless install? quiet: !(logger.level == Logger::DEBUG)

      UNIT_TYPES.each do |type|
        units[type.to_s.pluralize.to_sym].each do |unit|
Severity: Minor
Found in lib/config_curator/collection.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 install? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def install?
      s = super
      return s unless s
      fail InstallFailed, 'No component source path specified.' if source_path.nil?
      fail InstallFailed, 'No component install path specified.' if destination_path.nil?
Severity: Minor
Found in lib/config_curator/units/component.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