2021-02-12 07:09:02 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-10 06:10:54 -04:00
|
|
|
# FIXME: git.info_for_file raises the following error
|
|
|
|
# /usr/local/bundle/gems/git-1.4.0/lib/git/lib.rb:956:in `command': (Danger::DSLError)
|
|
|
|
# [!] Invalid `Dangerfile` file:
|
2019-11-27 07:06:30 -05:00
|
|
|
# [!] Invalid `Dangerfile` file: git '--git-dir=/builds/gitlab-org/gitlab/.git' '--work-tree=/builds/gitlab-org/gitlab' cat-file '-t' '' 2>&1:fatal: Not a valid object name
|
2018-07-10 06:10:54 -04:00
|
|
|
# This seems to be the same as https://github.com/danger/danger/issues/535.
|
|
|
|
|
|
|
|
# locale_files_updated = git.modified_files.select { |path| path.start_with?('locale') }
|
|
|
|
# locale_files_updated.each do |locale_file_updated|
|
|
|
|
# git_stats = git.info_for_file(locale_file_updated)
|
|
|
|
# message "Git stats for #{locale_file_updated}: #{git_stats[:insertions]} insertions, #{git_stats[:deletions]} insertions"
|
|
|
|
# end
|
2018-05-21 12:41:21 -04:00
|
|
|
|
2018-07-10 06:10:54 -04:00
|
|
|
if git.lines_of_code > 2_000
|
2021-02-22 04:10:46 -05:00
|
|
|
warn "This merge request is definitely too big (#{git.lines_of_code} lines changed), please split it into multiple merge requests."
|
2018-07-10 06:10:54 -04:00
|
|
|
elsif git.lines_of_code > 500
|
2021-02-22 04:10:46 -05:00
|
|
|
warn "This merge request is quite big (#{git.lines_of_code} lines changed), please consider splitting it into multiple merge requests."
|
2018-05-21 12:41:21 -04:00
|
|
|
end
|