Module: RuboCop::Chef::CookbookOnly

Extended by:
ClassMethods
Defined in:
lib/rubocop/chef/cookbook_only.rb

Overview

Mixin for cops that skips non-cookbook files

The criteria for whether cookstyle analyzes a certain ruby file is configured via ‘AllCops/Chef`. For example, if you want to customize your project to scan all files within a `test/` directory then you could add this to your configuration:

Examples:

configuring analyzed paths


AllCops:
  Chef:
    Patterns:
    - '_spec.rb$'
    - '(?:^|/)spec/'

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DEFAULT_CONFIGURATION =
CONFIG.fetch('AllCops')
COOKBOOK_SEGMENTS =
%w(attributes definitions libraries metadata providers recipes resources).freeze

Instance Attribute Summary

Attributes included from ClassMethods

#cookbook_only_segments

Instance Method Summary collapse

Methods included from ClassMethods

included

Instance Method Details

#relevant_file?(file) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rubocop/chef/cookbook_only.rb', line 24

def relevant_file?(file)
  cookbook_pattern =~ file && super
end