Class: Dependabot::PullRequestCreator::MessageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/pull_request_creator/message_builder.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(art zap fire bug ambulance sparkles memo rocket
lipstick tada white_check_mark lock apple penguin
checkered_flag robot green_apple bookmark
rotating_light construction green_heart arrow_down
arrow_up pushpin construction_worker
chart_with_upwards_trend recycle heavy_minus_sign
whale heavy_plus_sign wrench globe_with_meridians
pencil2 hankey rewind twisted_rightwards_arrows
package alien truck page_facing_up boom bento
ok_hand wheelchair bulb beers speech_balloon
card_file_box loud_sound mute busts_in_silhouette
children_crossing building_construction iphone
clown_face egg see_no_evil camera_flash).freeze
ISSUE_TAG_REGEX =
/(?<=[^A-Za-z0-9\[\\]|^)\\*(?<tag>(?:\#|GH-)\d+)(?=[^A-Za-z0-9\-]|$)/.
freeze
GITHUB_REF_REGEX =
%r{github\.com/[^/\s]+/[^/\s]+/(?:issue|pull)}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, dependencies:, files:, credentials:, pr_message_footer: nil, author_details: nil, vulnerabilities_fixed: {}) ⇒ MessageBuilder

Returns a new instance of MessageBuilder.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def initialize(source:, dependencies:, files:, credentials:,
               pr_message_footer: nil, author_details: nil,
               vulnerabilities_fixed: {})
  @dependencies          = dependencies
  @files                 = files
  @source                = source
  @credentials           = credentials
  @pr_message_footer     = pr_message_footer
  @author_details        = author_details
  @vulnerabilities_fixed = vulnerabilities_fixed
end

Instance Attribute Details

#author_detailsObject (readonly)

Returns the value of attribute author_details.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def author_details
  @author_details
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def credentials
  @credentials
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def dependencies
  @dependencies
end

#filesObject (readonly)

Returns the value of attribute files.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def files
  @files
end

Returns the value of attribute pr_message_footer.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def pr_message_footer
  @pr_message_footer
end

#sourceObject (readonly)

Returns the value of attribute source.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def source
  @source
end

#vulnerabilities_fixedObject (readonly)

Returns the value of attribute vulnerabilities_fixed.



35
36
37
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 35

def vulnerabilities_fixed
  @vulnerabilities_fixed
end

Instance Method Details

#commit_messageObject



60
61
62
63
64
65
66
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 60

def commit_message
  message = commit_subject + "\n\n"
  message += commit_message_intro
  message += 
  message += "\n\n" + signoff_message if signoff_message
  message
end

#pr_messageObject



56
57
58
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 56

def pr_message
  commit_message_intro +  + prefixed_pr_message_footer
end

#pr_nameObject



50
51
52
53
54
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 50

def pr_name
  return library_pr_name if library?

  application_pr_name
end