module Inspec::Plugin::V2::FilterPredicates

To be a valid plugin name, the plugin must beign with either inspec- or train-, AND ALSO not be on the exclusion list. We maintain this exclusion list to avoid confusing users. For example, we want to have a real gem named inspec-test-fixture, but we don't want the users to see that.

Public Instance Methods

inspec_plugin_name?(name) click to toggle source
# File lib/inspec/plugin/v2/filter.rb, line 76
def inspec_plugin_name?(name)
  valid_plugin_name?(name, :inspec)
end
train_plugin_name?(name) click to toggle source
# File lib/inspec/plugin/v2/filter.rb, line 72
def train_plugin_name?(name)
  valid_plugin_name?(name, :train)
end
valid_plugin_name?(name, kind = :either) click to toggle source
# File lib/inspec/plugin/v2/filter.rb, line 80
def valid_plugin_name?(name, kind = :either)
  # Must have a permitted prefix.
  return false unless case kind
  when :inspec
    name.to_s.start_with?("inspec-")
  when :train
    name.to_s.start_with?("train-")
  when :either
    name.to_s.match(/^(inspec|train)-/)
  else false
  end # rubocop: disable Layout/EndAlignment

  # And must not be on the exclusion list.
  ! Inspec::Plugin::V2::PluginFilter.exclude?(name)
end