Module: Gitlab::Dangerfiles::TitleLinting
- Defined in:
- lib/gitlab/dangerfiles/title_linting.rb
Constant Summary collapse
- DRAFT_REGEX =
/\A*#{Regexp.union(/(?i)(\[WIP\]\s*|WIP:\s*|WIP$)/, /(?i)(\[draft\]|\(draft\)|draft:|draft\s\-\s|draft$)/)}+\s*/i.freeze
- CHERRY_PICK_REGEX =
/cherry[\s-]*pick/i.freeze
- RUN_ALL_RSPEC_REGEX =
/RUN ALL RSPEC/i.freeze
- RUN_AS_IF_FOSS_REGEX =
/RUN AS-IF-FOSS/i.freeze
Class Method Summary collapse
- .has_cherry_pick_flag?(title) ⇒ Boolean
- .has_draft_flag?(title) ⇒ Boolean
- .has_run_all_rspec_flag?(title) ⇒ Boolean
- .has_run_as_if_foss_flag?(title) ⇒ Boolean
- .remove_draft_flag(title) ⇒ Object
- .sanitize_mr_title(title) ⇒ Object
Class Method Details
.has_cherry_pick_flag?(title) ⇒ Boolean
27 28 29 |
# File 'lib/gitlab/dangerfiles/title_linting.rb', line 27 def has_cherry_pick_flag?(title) CHERRY_PICK_REGEX.match?(title) end |
.has_draft_flag?(title) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/gitlab/dangerfiles/title_linting.rb', line 21 def has_draft_flag?(title) puts "This method is deprecated in favor of `helper.draft_mr?`." DRAFT_REGEX.match?(title) end |
.has_run_all_rspec_flag?(title) ⇒ Boolean
31 32 33 |
# File 'lib/gitlab/dangerfiles/title_linting.rb', line 31 def has_run_all_rspec_flag?(title) RUN_ALL_RSPEC_REGEX.match?(title) end |
.has_run_as_if_foss_flag?(title) ⇒ Boolean
35 36 37 |
# File 'lib/gitlab/dangerfiles/title_linting.rb', line 35 def has_run_as_if_foss_flag?(title) RUN_AS_IF_FOSS_REGEX.match?(title) end |
.remove_draft_flag(title) ⇒ Object
17 18 19 |
# File 'lib/gitlab/dangerfiles/title_linting.rb', line 17 def remove_draft_flag(title) title.gsub(DRAFT_REGEX, "") end |
.sanitize_mr_title(title) ⇒ Object
13 14 15 |
# File 'lib/gitlab/dangerfiles/title_linting.rb', line 13 def sanitize_mr_title(title) remove_draft_flag(title).gsub(/`/, '\\\`') end |