Class: Dependabot::PullRequestCreator::BranchNamer::DependencyGroupStrategy

Inherits:
Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb

Instance Attribute Summary

Attributes inherited from Base

#branch_name_case, #dependencies, #files, #max_length, #prefix, #separator, #target_branch, #template, #word_separator

Instance Method Summary collapse

Constructor Details

#initialize(dependencies:, files:, target_branch:, dependency_group:, includes_security_fixes:, separator: "/", prefix: "dependabot", max_length: nil, word_separator: nil, branch_name_case: nil, template: nil) ⇒ DependencyGroupStrategy

Returns a new instance of DependencyGroupStrategy.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb', line 29

def initialize(
  dependencies:,
  files:,
  target_branch:,
  dependency_group:,
  includes_security_fixes:,
  separator: "/",
  prefix: "dependabot",
  max_length: nil,
  word_separator: nil,
  branch_name_case: nil,
  template: nil
)
  super(
    dependencies: dependencies,
    files: files,
    target_branch: target_branch,
    separator: separator,
    prefix: prefix,
    max_length: max_length,
    word_separator: word_separator,
    branch_name_case: branch_name_case,
    template: template,
  )

  @dependency_group = dependency_group
  @includes_security_fixes = includes_security_fixes
end

Instance Method Details

#new_branch_nameObject



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb', line 59

def new_branch_name
  if template
    return render_from_template(
      vars: template_vars,
      strategy: :group,
      digest: dependency_digest
    )
  end

  sanitize_branch_name(File.join(prefixes, group_name_with_dependency_digest))
end