Remove most hard-coded usages of `master`
Part of https://gitlab.com/gitlab-org/release-tools/-/issues/451
Before:
$ be rubocop --only ReleaseTools/DefaultBranchLiteral
348 files inspected, 28 offenses detected
After:
$ be rubocop --only ReleaseTools/DefaultBranchLiteral
348 files inspected, 11 offenses detected
Remaining:
lib/release_tools/changelog/compiler.rb:60:65: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
master_paths = paths & unreleased_changelog_entry_paths('master')
^^^^^^^^
lib/release_tools/changelog/compiler.rb:62:57: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
compile_entries(version, entries, master_paths, 'master')
^^^^^^^^
lib/release_tools/metrics/auto_deploy_pressure.rb:37:50: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
counts[sha] ||= commit_pressure(sha, 'master')
^^^^^^^^
lib/release_tools/release_metadata.rb:23:29: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
DEFAULT_COMPONENT_REF = 'master'
^^^^^^^^
lib/release_tools/release_metadata_uploader.rb:9:14: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
BRANCH = 'master'
^^^^^^^^
lib/release_tools/remote_repository.rb:57:44: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
def ensure_branch_exists(branch, base: 'master')
^^^^^^^^
lib/release_tools/remote_repository.rb:74:43: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
def checkout_new_branch(branch, base: 'master')
^^^^^^^^
lib/release_tools/security/implementation_issue.rb:29:34: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
DEFAULT_BRANCHES = %w[main master].freeze
^^^^^^
lib/release_tools/security/merge_request_validator.rb:236:41: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
@merge_request.target_branch == 'master' || @merge_request.target_branch == 'main'
^^^^^^^^
lib/release_tools/security/merge_requests_batch_merger.rb:9:29: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
PICKABLE_TARGETS = %w[master main].freeze
^^^^^^
lib/release_tools/security/merge_train_service.rb:25:24: C: ReleaseTools/DefaultBranchLiteral: Use a project's default_branch method instead of a String literal.
SUBJECT_BRANCH = 'master'
^^^^^^^^
Edited by Robert Speicher