rambler-digital-solutions/Generamba

View on GitHub
lib/generamba/helpers/rambafile_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage

Line is too long. [157/80]
Open

        puts "You can't run *generamba gen* without any templates installed. Add their declarations to a Rambafile and run *generamba template install*.".red

Prefer using YAML.safe_load over YAML.load.
Open

      preferences = file_contents.empty? ? {} : YAML.load(file_contents).to_hash

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

      unless preferences[TEMPLATES_KEY]

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

There are no issues that match your filters.

Category
Status