diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-16 14:25:26 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-08-16 14:25:26 +0300 |
commit | fcce6c3168dbd04404f318b4e983d7395d21538c (patch) | |
tree | d8155d729f0915f6117bbe1f4010fffec9d37e56 /app/models/protectable_dropdown.rb | |
parent | 9ac2a517798af2f942b28138403690afc20a254c (diff) | |
parent | 260c8da060a6039cbd47cfe31c8ec6d6f9b43de0 (diff) |
Merge branch 'rs-more-public-send-whitelists' into 'master'
Whitelist or fix additional `Gitlab/PublicSend` cop violations
See merge request !13467
Diffstat (limited to 'app/models/protectable_dropdown.rb')
-rw-r--r-- | app/models/protectable_dropdown.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/protectable_dropdown.rb b/app/models/protectable_dropdown.rb index 122fbce257d..c96edc5a259 100644 --- a/app/models/protectable_dropdown.rb +++ b/app/models/protectable_dropdown.rb @@ -1,5 +1,9 @@ class ProtectableDropdown + REF_TYPES = %i[branches tags].freeze + def initialize(project, ref_type) + raise ArgumentError, "invalid ref type `#{ref_type}`" unless ref_type.in?(REF_TYPES) + @project = project @ref_type = ref_type end @@ -16,7 +20,7 @@ class ProtectableDropdown private def refs - @project.repository.public_send(@ref_type) + @project.repository.public_send(@ref_type) # rubocop:disable GitlabSecurity/PublicSend end def ref_names @@ -24,7 +28,7 @@ class ProtectableDropdown end def protections - @project.public_send("protected_#{@ref_type}") + @project.public_send("protected_#{@ref_type}") # rubocop:disable GitlabSecurity/PublicSend end def non_wildcard_protected_ref_names |