gitlab-org--gitlab-foss/scripts/ee-specific-lines-check

42 lines
1.3 KiB
Ruby
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env ruby
require_relative 'ee_specific_check/ee_specific_check'
include EESpecificCheck # rubocop:disable Style/MixinUsage
git_version
base = find_compare_base
current_numstat = updated_diff_numstat(base.ce_base, base.ee_base)
updated_numstat = updated_diff_numstat(base.ce_head, base.ee_head)
offenses = updated_numstat.select do |file, updated_delta|
current_delta = current_numstat[file]
more_lines = updated_delta > current_delta
more_lines &&
!WHITELIST.any? { |pattern| Dir.glob(pattern, File::FNM_DOTMATCH).include?(file) }
end
if offenses.empty?
say "🎉 All good, congrats! 🎉"
else
puts
offenses.each do |(file, delta)|
puts "* 💥 #{file} has #{delta - current_numstat[file]} updated lines that differ between EE and CE! 💥"
end
say <<~MESSAGE
Make sure all lines in shared files have been updated in your backport merge request and the branch name includes #{minimal_ce_branch_name}.
Consider using an EE module to add the features you want.
See this for detail: https://docs.gitlab.com/ee/development/ee_features.html#ee-features-based-on-ce-features
MESSAGE
end
remove_remotes
say " For more information on why, see https://gitlab.com/gitlab-org/gitlab/issues/2952"
exit(offenses.size)