class RuboCop::Cop::Gemspec::DevelopmentDependencies


gem “bar”
# Gemfile
# good (with AllowedGems: [“bar”])
s.add_development_dependency “foo”
# example.gemspec
# good
gem “foo”
# Gemfile
# bad
# Specify all dependencies in your gemspec.
@example EnforcedStyle: gemspec
s.add_development_dependency “bar”
# example.gemspec
# good (with AllowedGems: [“bar”])
gem “foo”
# gems.rb
# good
gem “foo”
# Gemfile
# good
s.add_development_dependency “foo”
# example.gemspec
# bad
# Rely on Bundler/GemFilename to enforce the use of ‘Gemfile` vs `gems.rb`.
# Identical to `EnforcedStyle: Gemfile`, but with a different error message.
#
# but all other dependencies in your Gemfile.
# Specify runtime dependencies in your gemspec,
@example EnforcedStyle: gems.rb
s.add_development_dependency “bar”
# example.gemspec
# good (with AllowedGems: [“bar”])
gem “foo”
# gems.rb
# good
gem “foo”
# Gemfile
# good
s.add_development_dependency “foo”
# example.gemspec
# bad
# but all other dependencies in your Gemfile.
# Specify runtime dependencies in your gemspec,
@example EnforcedStyle: Gemfile (default)
rather than in `Gemfile`.
gemspec`, enforce that all dependencies are specified in `gemspec`,
`add_development_dependency`. Alternatively, using `EnforcedStyle:
`Gemfile`, rather than in the `gemspec` using
Enforce that development dependencies for a gem are specified in

def forbidden_gem?(gem_name)

def forbidden_gem?(gem_name)
  !cop_config['AllowedGems'].include?(gem_name)
end

def message(_range)

def message(_range)
  format(MSG, preferred: style)
end

def on_send(node)

def on_send(node)
  case style
  when :Gemfile, :'gems.rb'
    add_offense(node) if add_development_dependency?(node)
  when :gemspec
    add_offense(node) if gem?(node)
  end
end