GomaaK/sshez

View on GitHub

Showing 11 of 11 total issues

Method remove_alias_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_alias_name(alias_name, file, new_file)
      started_removing = false
      file.each do |line|
        started_removing ||= line.include?("Host #{alias_name}")
        if started_removing
Severity: Minor
Found in lib/sshez/exec.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

Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used.
Open

    def connect(alias_name, options)
Severity: Minor
Found in lib/sshez/exec.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Put one space between the method name and the first argument.
Open

      if servers.include?alias_name
Severity: Minor
Found in lib/sshez/exec.rb by rubocop

Checks that exactly one space is used between a method name and the first argument for method calls without parentheses.

Alternatively, extra spaces can be added to align the argument with something on a preceding or following line, if the AllowForAlignment config parameter is true.

Example:

# bad
something  x
something   y, z
something'hello'

# good
something x
something y, z
something 'hello'

Put one space between the method name and the first argument.
Open

      if servers.include?alias_name
Severity: Minor
Found in lib/sshez/exec.rb by rubocop

Checks that exactly one space is used between a method name and the first argument for method calls without parentheses.

Alternatively, extra spaces can be added to align the argument with something on a preceding or following line, if the AllowForAlignment config parameter is true.

Example:

# bad
something  x
something   y, z
something'hello'

# good
something x
something y, z
something 'hello'

Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used. You can also write as reset(*) if you want the method to accept any arguments but don't care about them.
Open

    def reset(options)
Severity: Minor
Found in lib/sshez/exec.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused block argument - key. If it's necessary, use _ or _key as an argument name to indicate that it won't be used.
Open

      options.file_content.each_pair do |key, value|
Severity: Minor
Found in lib/sshez/exec.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

Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used.
Open

    def remove(alias_name, options)
Severity: Minor
Found in lib/sshez/exec.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used. You can also write as list(*) if you want the method to accept any arguments but don't care about them.
Open

    def list(options)
Severity: Minor
Found in lib/sshez/exec.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

TODO found
Open

                 (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop.yml by fixme

FIXME found
Open

                 (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop.yml by fixme

HACK found
Open

                 (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop.yml by fixme
Severity
Category
Status
Source
Language