Class: Dependabot::PullRequestCreator::PrNamePrefixer

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/pull_request_creator/pr_name_prefixer.rb

Constant Summary collapse

ANGULAR_PREFIXES =
%w(build chore ci docs feat fix perf refactor style
test).freeze
ESLINT_PREFIXES =
%w(Breaking Build Chore Docs Fix New Update
Upgrade).freeze
GITMOJI_PREFIXES =
%w(alien ambulance apple arrow_down arrow_up art beers
bento bookmark boom bug building_construction bulb
busts_in_silhouette camera_flash card_file_box
chart_with_upwards_trend checkered_flag
children_crossing clown_face construction
construction_worker egg fire globe_with_meridians
green_apple green_heart hankey heavy_minus_sign
heavy_plus_sign iphone lipstick lock loud_sound memo
mute ok_hand package page_facing_up pencil2 penguin
pushpin recycle rewind robot rocket rotating_light
see_no_evil sparkles speech_balloon tada truck
twisted_rightwards_arrows whale wheelchair
white_check_mark wrench zap).freeze

Instance Method Summary collapse

Constructor Details

#initialize(source:, dependencies:, credentials:, security_fix: false, commit_message_options: {}) ⇒ PrNamePrefixer

Returns a new instance of PrNamePrefixer.



29
30
31
32
33
34
35
36
# File 'lib/dependabot/pull_request_creator/pr_name_prefixer.rb', line 29

def initialize(source:, dependencies:, credentials:, security_fix: false,
               commit_message_options: {})
  @dependencies           = dependencies
  @source                 = source
  @credentials            = credentials
  @security_fix           = security_fix
  @commit_message_options = commit_message_options
end

Instance Method Details

#capitalize_first_word?Boolean

Returns:

  • (Boolean)


44
45
46
47
48
49
50
# File 'lib/dependabot/pull_request_creator/pr_name_prefixer.rb', line 44

def capitalize_first_word?
  return !commit_message_options[:prefix]&.strip&.match?(/\A[a-z]/) if commit_message_options.key?(:prefix)

  return capitalise_first_word_from_last_dependabot_commit_style if last_dependabot_commit_style

  capitalise_first_word_from_previous_commits
end

#pr_name_prefixObject



38
39
40
41
42
# File 'lib/dependabot/pull_request_creator/pr_name_prefixer.rb', line 38

def pr_name_prefix
  prefix = commit_prefix.to_s
  prefix += security_prefix if security_fix?
  prefix.gsub("⬆️ 🔒", "⬆️🔒")
end