razor-x/config_curator

View on GitHub
lib/config_curator/units/component.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

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 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

There are no issues that match your filters.

Category
Status