Class: Dependabot::PullRequestCreator::MessageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/pull_request_creator/message_builder.rb,
lib/dependabot/pull_request_creator/message_builder/issue_linker.rb

Defined Under Namespace

Classes: IssueLinker

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
GITHUB_REF_REGEX =
%r{
  (?:https?://)?
  github\.com/[^/\s]+/[^/\s]+/
  (?:issue|pull)s?/(?<number>\d+)
}x.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: {}, github_redirection_service: nil) ⇒ MessageBuilder

Returns a new instance of MessageBuilder.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 42

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

Instance Attribute Details

#author_detailsObject (readonly)

Returns the value of attribute author_details.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def author_details
  @author_details
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def credentials
  @credentials
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def dependencies
  @dependencies
end

#filesObject (readonly)

Returns the value of attribute files.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def files
  @files
end

#github_redirection_serviceObject (readonly)

Returns the value of attribute github_redirection_service.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def github_redirection_service
  @github_redirection_service
end

Returns the value of attribute pr_message_footer.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def pr_message_footer
  @pr_message_footer
end

#sourceObject (readonly)

Returns the value of attribute source.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def source
  @source
end

#vulnerabilities_fixedObject (readonly)

Returns the value of attribute vulnerabilities_fixed.



38
39
40
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 38

def vulnerabilities_fixed
  @vulnerabilities_fixed
end

Instance Method Details

#commit_messageObject



65
66
67
68
69
70
71
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 65

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

#pr_messageObject



61
62
63
# File 'lib/dependabot/pull_request_creator/message_builder.rb', line 61

def pr_message
  commit_message_intro +  + prefixed_pr_message_footer
end

#pr_nameObject



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

def pr_name
  return library_pr_name if library?

  application_pr_name
end