Commit f818d961 authored by Thong Kuah's avatar Thong Kuah

Rename internal method to denylist

parent 08c606d5
...@@ -78,7 +78,7 @@ class PushRule < ApplicationRecord ...@@ -78,7 +78,7 @@ class PushRule < ApplicationRecord
data_match?(email, author_email_regex) data_match?(email, author_email_regex)
end end
def filename_blacklisted?(file_path) def filename_denylisted?(file_path)
regex_list = [] regex_list = []
regex_list.concat(FILES_DENYLIST) if prevent_secrets regex_list.concat(FILES_DENYLIST) if prevent_secrets
regex_list << file_name_regex if file_name_regex regex_list << file_name_regex if file_name_regex
......
...@@ -82,7 +82,7 @@ module EE ...@@ -82,7 +82,7 @@ module EE
def file_name_validation def file_name_validation
lambda do |diff| lambda do |diff|
if (diff.renamed_file || diff.new_file) && blacklisted_regex = push_rule.filename_blacklisted?(diff.new_path) if (diff.renamed_file || diff.new_file) && blacklisted_regex = push_rule.filename_denylisted?(diff.new_path)
return unless blacklisted_regex.present? return unless blacklisted_regex.present?
"File name #{diff.new_path} was blacklisted by the pattern #{blacklisted_regex}." "File name #{diff.new_path} was blacklisted by the pattern #{blacklisted_regex}."
......
...@@ -132,7 +132,7 @@ describe PushRule do ...@@ -132,7 +132,7 @@ describe PushRule do
commit_message_blocked?: :commit_message_negative_regex, commit_message_blocked?: :commit_message_negative_regex,
branch_name_allowed?: :branch_name_regex, branch_name_allowed?: :branch_name_regex,
author_email_allowed?: :author_email_regex, author_email_allowed?: :author_email_regex,
filename_blacklisted?: :file_name_regex filename_denylisted?: :file_name_regex
} }
methods_and_regexes.each do |method_name, regex_attr| methods_and_regexes.each do |method_name, regex_attr|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment