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 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
24
25
26
27
# File 'lib/gitlab/checks/diff_check.rb', line 12

def validate!
  # git-notes stores notes history as commits in refs/notes/commits (by
  # default but is configurable) so we restrict the diff checks to tag
  # and branch refs
  return unless tag_ref? || branch_ref?
  return if deletion?
  return unless should_run_validations?
  return if commits.empty?

  paths = project.repository.find_changed_paths(treeish_objects, merge_commit_diff_mode: :all_parents)
  paths.each do |path|
    validate_path(path)
  end

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