class RuboCop::Cop::Chef::Ruby::GemspecLicense

All gemspec files should define their license.

@example

# good
spec.license = "Apache-2.0"

Constants

MSG

Public Instance Methods

on_new_investigation() click to toggle source
# File lib/rubocop/cop/chef/ruby/gemspec_license.rb, line 43
def on_new_investigation
  # exit if we find a license statement or any eval since that usually happens
  # when we have a windows platform gem that evals the main gemspec
  return if license(processed_source.ast).first || eval_method(processed_source.ast).first

  range = source_range(processed_source.buffer, 1, 0)
  add_offense(range, message: MSG, severity: :warning)
end