lib/generamba/helpers/rambafile_validator.rb
Line is too long. [157/80] Open
Open
puts "You can't run *generamba gen* without any templates installed. Add their declarations to a Rambafile and run *generamba template install*.".red
- Exclude checks
Prefer using YAML.safe_load
over YAML.load
. Open
Open
preferences = file_contents.empty? ? {} : YAML.load(file_contents).to_hash
- Read upRead up
- Exclude checks
This cop checks for the use of YAML class methods which have potential security issues leading to remote code execution when loading from an untrusted source.
Example:
# bad
YAML.load("--- foo")
# good
YAML.safe_load("--- foo")
YAML.dump("foo")
Use a guard clause instead of wrapping the code inside a conditional expression. Open
Open
unless preferences[TEMPLATES_KEY]
- Read upRead up
- Exclude checks
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