Skip to content

Commit

Permalink
[Fix #10245] Add deprecated attributes
Browse files Browse the repository at this point in the history
Add specification_version and rubygems_version
to Gemspec/DeprecatedAttributeAssignment
  • Loading branch information
kaitithoma authored and bbatsov committed Jun 20, 2022
1 parent c6a4e91 commit 2eb3844
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/new_add_deprecated_attributes.md
@@ -0,0 +1 @@
* [#10245](https://github.com/rubocop/rubocop/pull/10245): Add specification_version and rubygems_version to `Gemspec/DeprecatedAttributeAssignment`. ([@kaitielth][])
2 changes: 1 addition & 1 deletion lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
Expand Up @@ -70,7 +70,7 @@ def node_and_method_name(node, attribute)
end

def use_deprecated_attributes?(node, block_parameter)
%i[test_files date].each do |attribute|
%i[test_files date specification_version rubygems_version].each do |attribute|
node, method_name = node_and_method_name(node, attribute)
unless node.send_type? && node.receiver&.source == block_parameter &&
node.method?(method_name)
Expand Down
Expand Up @@ -92,6 +92,8 @@
end

it_behaves_like 'deprecated attributes', 'date', "Time.now.strftime('%Y-%m-%d')"
it_behaves_like 'deprecated attributes', 'rubygems_version', '2.5'
it_behaves_like 'deprecated attributes', 'specification_version', '2.5'
it_behaves_like 'deprecated attributes', 'test_files', "Dir.glob('test/**/*')"
it_behaves_like 'deprecated attributes with addition', 'test_files', "Dir.glob('test/**/*')"
end

0 comments on commit 2eb3844

Please sign in to comment.