lib/old_tasks/redirects.rake

Summary

Maintainability
Test Coverage

Method has too many lines. [23/10]
Open

  def start_element(name, attributes = [])
    case name.to_sym
    when :Table
      self.within_table = true
    when :Row
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for start_element is too high. [27.31/15]
Open

  def start_element(name, attributes = [])
    case name.to_sym
    when :Table
      self.within_table = true
    when :Row
Severity: Minor
Found in lib/old_tasks/redirects.rake 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 has too many lines. [13/10]
Open

  def end_element(name)
    case name.to_sym
    when :Table
      self.within_table = false
      self.current_row = 0
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for start_element is too high. [8/6]
Open

  def start_element(name, attributes = [])
    case name.to_sym
    when :Table
      self.within_table = true
    when :Row
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Use %r around regular expression.
Open

    excel_xml.gsub!(/<(?:ss\:)?Data[^>]*>(.*)<\/(?:ss\:)?Data>/i) do |match|
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

This cop enforces using // or %r around regular expressions.

Example: EnforcedStyle: slashes (default)

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = %r{
  foo
  (bar)
  (baz)
}x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = /
  foo
  (bar)
  (baz)
/x

Example: EnforcedStyle: percent_r

# bad
snake_case = /^[\dA-Z_]+$/

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = %r{^[\dA-Z_]+$}

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: EnforcedStyle: mixed

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: AllowInnerSlashes: false (default)

# If `false`, the cop will always recommend using `%r` if one or more
# slashes are found in the regexp string.

# bad
x =~ /home\//

# good
x =~ %r{home/}

Example: AllowInnerSlashes: true

# good
x =~ /home\//

Unused block argument - match. You can omit the argument if you don't care about it.
Open

    excel_xml.gsub!(/<(?:ss\:)?Data[^>]*>(.*)<\/(?:ss\:)?Data>/i) do |match|
Severity: Minor
Found in lib/old_tasks/redirects.rake 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 initialize(path_to_xl_xml_file, options = {})
Severity: Minor
Found in lib/old_tasks/redirects.rake 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

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if self.current_row == 1
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

self used in void context.
Open

    self
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

This cop checks for operators, variables and literals used in void context.

Example:

# bad

def some_method
  some_num * 10
  do_something
end

Example:

# bad

def some_method(some_var)
  some_var
  do_something
end

Example:

# good

def some_method
  do_something
  some_num * 10
end

Example:

# good

def some_method(some_var)
  do_something
  some_var
end

Avoid the use of Perl-style backrefs.
Open

      value = $1
Severity: Minor
Found in lib/old_tasks/redirects.rake by rubocop

This cop looks for uses of Perl-style regexp match backreferences like $1, $2, etc.

Example:

# bad
puts $1

# good
puts Regexp.last_match(1)

There are no issues that match your filters.

Category
Status