<commit_before>require 'chef/knife'

class Chef
  class Knife
    class Inspect < Knife
      CHECKLISTS = %w(Cookbooks DataBags DataBagItems Environments Roles)

      # :nocov:
      deps do
        require 'health_inspector'
      end
      # :nocov:

      banner 'knife inspect'

      def run
        results = CHECKLISTS.map do |checklist|
          HealthInspector::Checklists.const_get(checklist).run(self)
        end

        exit !results.include?(false)
      end
    end
  end
end<commit_msg>Allow to deactivate inspection by component<commit_after>require 'chef/knife'

class Chef
  class Knife
    class Inspect < Knife
      CHECKLISTS = %w(Cookbooks DataBags DataBagItems Environments Roles)

      # :nocov:
      deps do
        require 'health_inspector'
      end
      # :nocov:

      banner 'knife inspect'

      CHECKLISTS.map do |checklist|
        opt_name = checklist.downcase.to_sym
        option opt_name,
          :long => "--[no-]#{opt_name}",
          :boolean => true,
          :default => true,
          :description => "Add or exclude #{opt_name} from inspection"
      end

      def run
        results = CHECKLISTS.select do |checklist|
          opt_name = checklist.downcase.to_sym
          config[opt_name] or config[opt_name].nil?
        end.map do |checklist|
          HealthInspector::Checklists.const_get(checklist).run(self)
        end

        exit !results.include?(false)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08561643835616438, 'fraction_numerical': 0.0, 'mean_word_length': 2.1899563318777293, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1173984', 'n_tokens_mistral': 463, 'n_tokens_neox': 450, 'n_words': 111}