Class: RuboCop::Cop::Chef::RedundantCode::AptRepositoryDistributionDefault
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Chef::RedundantCode::AptRepositoryDistributionDefault
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp, RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb
Overview
There is no need to pass ‘distribution node[’codename’]‘ to an apt_repository resource as this is done automatically by the apt_repository resource.
Constant Summary collapse
- MSG =
"There is no need to pass `distribution node['lsb']['codename']` to an apt_repository resource as this is done automatically by the apt_repository resource."
Instance Method Summary collapse
Methods included from RuboCop::Chef::CookbookHelpers
#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string
Methods inherited from Base
Instance Method Details
#on_block(node) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb', line 52 def on_block(node) match_property_in_resource?(:apt_repository, 'distribution', node) do |dist| default_dist?(dist) do add_offense(dist, severity: :refactor) do |corrector| corrector.remove(range_with_surrounding_space(range: dist.loc.expression, side: :left)) end end end end |