class RuboCop::Cop::Itamae::RecipePath
Checks whether the recipe is placed under `cookbooks` dir or `roles` dir.
@see github.com/itamae-kitchen/itamae/wiki/Best-Practice#directory-structure
@example
# bad default.rb hoge/web.rb # good cookbooks/nginx/default.rb roles/web.rb
Constants
- MSG
Public Instance Methods
on_new_investigation()
click to toggle source
# 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
Private Instance Methods
bad_filename?(file_path)
click to toggle source
# File lib/rubocop/cop/itamae/recipe_path.rb, line 35 def bad_filename?(file_path) return unless File.extname(file_path) == '.rb' !file_path.match?(%r{/(cookbooks|roles)/}) end