Class: RuboCop::Cop::Chef::ChefStyle::DefaultCopyrightComments
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefStyle::DefaultCopyrightComments
- Defined in:
- lib/rubocop/cop/chef/style/comments_default_copyright.rb
Overview
Checks for default copyright comments from the chef generator cookbook command
Constant Summary collapse
- MSG =
'Cookbook copyright comment headers should be updated for a real person or organization.'.freeze
Instance Method Summary collapse
Instance Method Details
#investigate(processed_source) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rubocop/cop/chef/style/comments_default_copyright.rb', line 37 def investigate(processed_source) return unless processed_source.ast processed_source.comments.each do |comment| next unless comment.inline? # headers aren't in blocks if /# (?:Copyright\W*).*YOUR_(NAME|COMPANY_NAME)/.match?(comment.text) add_offense(comment, location: comment.loc.expression, message: MSG, severity: :refactor) end end end |