Class: Gitlab::Checks::DiffCheck

Inherits:
BaseSingleChecker show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/checks/diff_check.rb

Constant Summary collapse

LOG_MESSAGES =
{
  validate_file_paths: "Validating diffs' file paths..."
}.freeze

Instance Attribute Summary

Attributes inherited from BaseSingleChecker

#change_access

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseSingleChecker

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Checks::BaseSingleChecker

Instance Method Details

#validate!Object


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/checks/diff_check.rb', line 12

def validate!
  return if deletion?
  return unless should_run_validations?
  return if commits.empty?

  paths = project.repository.find_changed_paths(commits.map(&:sha))
  paths.each do |path|
    validate_path(path)
  end

  validate_file_paths(paths.map(&:path).uniq)
end