Sha256: 5d6598964fca11c920983be597f1b34cc3f522ce94ae768b17212759d35bfd42

Contents?: true

Size: 1.49 KB

Versions: 8

Compression:

Stored size: 1.49 KB

Contents

#
# Copyright:: Copyright 2019, Chef Software Inc.
# Author:: Tim Smith (<tsmith@chef.io>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
module RuboCop
  module Cop
    module Chef
      module ChefCorrectness
        # dnf_package does not support the allow_downgrades property
        #
        # @example
        #
        #   # bad
        #   dnf_package 'nginx' do
        #     version '1.2.3'
        #     allow_downgrades true
        #   end
        #
        #   # good
        #   dnf_package 'nginx' do
        #     version '1.2.3'
        #   end
        #
        class DnfPackageAllowDowngrades < Cop
          include RuboCop::Chef::CookbookHelpers

          MSG = 'dnf_package does not support the allow_downgrades property'.freeze

          def on_block(node)
            match_property_in_resource?(:dnf_package, :allow_downgrades, node) do |prop|
              add_offense(prop, location: :expression, message: MSG, severity: :refactor)
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cookstyle-5.22.6 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.21.9 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.20.0 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.19.9 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.18.4 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.17.4 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.16.11 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb
cookstyle-5.16.10 lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb