Class: RuboCop::Cop::Chef::Style::ChefWhaaat

Inherits:
RuboCop::Cop show all
Defined in:
lib/rubocop/cop/chef/style/chef_whaaat.rb

Overview

Checks for comments that mention “Chef” without context. Do you mean Chef Infra or Chef Software?

Examples:


### incorrect
Chef makes software
Chef configures your systems

### correct
Chef Software makes software
Chef Infra configures your systems

Constant Summary collapse

MSG =
'Do you mean Chef (the company) or a Chef product (e.g. Chef Infra, Chef InSpec, etc)?'

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



37
38
39
40
41
42
43
44
# File 'lib/rubocop/cop/chef/style/chef_whaaat.rb', line 37

def on_new_investigation
  return unless processed_source.ast

  processed_source.comments.each do |comment|
    next unless comment.text.match?(/Chef [a-z]/) # https://rubular.com/r/0YzfDAbwJrDHix
    add_offense(comment, severity: :refactor)
  end
end