intercity/intercity-next

View on GitHub
app/jobs/install_server_job.rb

Summary

Maintainability
A
45 mins
Test Coverage

Assignment Branch Condition size for perform_installation is too high. [27.31/25]
Open

  def perform_installation
    SshExecution.new(server).execute_with_block do |ssh|
      ch = ssh.open_channel do |channel|
        logger.debug("Executing #{install_dokku}")
        channel.exec install_dokku do |_, success|
Severity: Minor
Found in app/jobs/install_server_job.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method perform_installation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def perform_installation
    SshExecution.new(server).execute_with_block do |ssh|
      ch = ssh.open_channel do |channel|
        logger.debug("Executing #{install_dokku}")
        channel.exec install_dokku do |_, success|
Severity: Minor
Found in app/jobs/install_server_job.rb - About 45 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

Line is too long. [123/110]
Open

      "wget -O bootstrap.sh https://raw.githubusercontent.com/dokku/dokku/#{server.latest_dokku_version}/bootstrap.sh && "\
Severity: Minor
Found in app/jobs/install_server_job.rb by rubocop

Extra empty line detected at block body beginning.
Open


          channel.on_extended_data do |_, type, data|
Severity: Minor
Found in app/jobs/install_server_job.rb by rubocop

This cops checks if empty lines around the bodies of blocks match the configuration.

Example: EnforcedStyle: empty_lines

# good

foo do |bar|

  # ...

end

Example: EnforcedStyle: noemptylines (default)

# good

foo do |bar|
  # ...
end

Unused block argument - success. You can omit all the arguments if you don't care about them.
Open

        channel.exec install_dokku do |_, success|
Severity: Minor
Found in app/jobs/install_server_job.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

There are no issues that match your filters.

Category
Status