debian-mirror-gitlab/lib/gitlab/bullet/exclusions.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
981 B
Ruby
Raw Normal View History

2021-04-29 21:17:54 +05:30
# frozen_string_literal: true
module Gitlab
module Bullet
class Exclusions
def initialize(config_file = Gitlab.root.join('config/bullet.yml'))
@config_file = config_file
end
def execute
exclusions.map { |v| v['exclude'] }
end
def validate_paths!
exclusions.each do |properties|
next unless properties['path_with_method']
file = properties['exclude'].first
raise "Bullet: File used by #{config_file} doesn't exist, validate the #{file} exclusion!" unless File.exist?(file)
end
end
private
attr_reader :config_file
def exclusions
@exclusions ||= if File.exist?(config_file)
2023-06-20 00:43:36 +05:30
config = YAML.safe_load_file(config_file, permitted_classes: [Range])
config['exclusions']&.values || []
2021-04-29 21:17:54 +05:30
else
[]
end
end
end
end
end