Showing 6 of 6 total issues
Class Secrets
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Secrets
CRYPTO_LIB = "openssl".freeze
CIPHER = "aes-256-cbc".freeze
PLAINTEXT_EXT = "priv".freeze
CIPHERTEXT_EXT = "crypt".freeze
Assignment Branch Condition size for install_symlinks is too high. [31.3/31] Open
def self.install_symlinks(config)
config.symlinks.each do |source_path, target_path|
# source = Symlink.new(source_path: File.expand_path(source_path))
# source.link
source = Pathname.new(source_path).expand_path
- Read upRead up
- Exclude checks
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 install_symlinks
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.install_symlinks(config)
config.symlinks.each do |source_path, target_path|
# source = Symlink.new(source_path: File.expand_path(source_path))
# source.link
source = Pathname.new(source_path).expand_path
- Read upRead up
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 link
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.link(source, target)
if File.exist?(target)
if File.symlink?(target)
existing_link = File.readlink(target)
- Read upRead up
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 each_child
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each_child(dir, &block)
dir.children.each do |child|
next if child.basename.to_s.start_with?(".")
if child.directory?
- Read upRead up
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
Use each_value
instead of each
. Open
config.mas.each do |_name, id|
- Read upRead up
- Exclude checks
This cop checks for uses of each_key
and each_value
Hash methods.
Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.
Example:
# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }
# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }