Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt GemspecGit cop to new API changes #19

Merged
merged 1 commit into from
Aug 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/rubocop/cop/packaging/gemspec_git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Packaging # :nodoc:
# spec.executables = Dir.glob("bin/*").map{ |f| File.basename(f) }
# end
#
class GemspecGit < Cop
class GemspecGit < Base
# This is the message that will be displayed when RuboCop finds an
# offense of using `git ls-files`.
MSG = "Avoid using git to produce lists of files. " \
Expand All @@ -72,13 +72,12 @@ class GemspecGit < Cop
# https://github.com/rubocop-hq/rubocop/blob/59543c8e2b66bff249de131fa9105f3eb11e9edb/lib/rubocop/cop/cop.rb#L13-L25
#
# Processing of the AST happens here.
def investigate(processed_source)
def on_new_investigation
return if processed_source.blank?

xstr(processed_source.ast).each do |node|
add_offense(
processed_source.ast,
location: node.loc.expression,
node.loc.expression,
message: MSG
)
end
Expand Down