ManageIQ/optimist

View on GitHub

Showing 44 of 44 total issues

private (on line 704) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
Open

  def self.get_type_from_disdef(optdef, opttype, disambiguated_default)
Severity: Minor
Found in lib/optimist.rb by rubocop

This cop checks for private or protected access modifiers which are applied to a singleton method. These access modifiers do not make singleton methods private/protected. private_class_method can be used for that.

Example:

# bad

class C
  private

  def self.method
    puts 'hi'
  end
end

Example:

# good

class C
  def self.method
    puts 'hi'
  end

  private_class_method :method
end

Example:

# good

class C
  class << self
    private

    def method
      puts 'hi'
    end
  end
end

private (on line 704) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
Open

  def self.handle_short_opt(sopt)
Severity: Minor
Found in lib/optimist.rb by rubocop

This cop checks for private or protected access modifiers which are applied to a singleton method. These access modifiers do not make singleton methods private/protected. private_class_method can be used for that.

Example:

# bad

class C
  private

  def self.method
    puts 'hi'
  end
end

Example:

# good

class C
  def self.method
    puts 'hi'
  end

  private_class_method :method
end

Example:

# good

class C
  class << self
    private

    def method
      puts 'hi'
    end
  end
end

Use tr instead of gsub.
Open

    lopt = lopt ? lopt.to_s : name.to_s.gsub("_", "-")
Severity: Minor
Found in lib/optimist.rb by rubocop

This cop identifies places where gsub can be replaced by tr or delete.

Example:

# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')

# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')

private (on line 704) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
Open

  def self.get_klass_from_default(opts, opttype)
Severity: Minor
Found in lib/optimist.rb by rubocop

This cop checks for private or protected access modifiers which are applied to a singleton method. These access modifiers do not make singleton methods private/protected. private_class_method can be used for that.

Example:

# bad

class C
  private

  def self.method
    puts 'hi'
  end
end

Example:

# good

class C
  def self.method
    puts 'hi'
  end

  private_class_method :method
end

Example:

# good

class C
  class << self
    private

    def method
      puts 'hi'
    end
  end
end
Severity
Category
Status
Source
Language