Class: RuboCop::Cop::Itamae::RecipePath

Inherits:
Base
  • Object
show all
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/itamae/recipe_path.rb

Overview

Checks whether the recipe is placed under cookbooks dir or roles dir.

Examples:

# bad
default.rb
hoge/web.rb

# good
cookbooks/nginx/default.rb
roles/web.rb

See Also:

Constant Summary collapse

MSG =
'Prefer recipe to placed under `cookbooks` dir' \
' or `roles` dir.'

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



26
27
28
29
30
31
# File 'lib/rubocop/cop/itamae/recipe_path.rb', line 26

def on_new_investigation
  file_path = processed_source.file_path
  return if config.file_to_include?(file_path)

  add_global_offense if bad_filename?(file_path)
end