Skip to content

Commit

Permalink
trace logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin-sandhu committed Oct 28, 2024
1 parent 6399c74 commit 1753cd2
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions common/lib/dependabot/pull_request_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ def initialize(source:, base_commit:, dependencies:, files:, credentials:,
@pr_message_max_length = pr_message_max_length
@pr_message_encoding = pr_message_encoding

if trace_log?
Dependabot.logger.info(
"Dependabot::PullRequestCreator::initialize : #{existing_branches}"
)
end

check_dependencies_have_previous_version
end

Expand All @@ -240,6 +246,12 @@ def check_dependencies_have_previous_version
# then convert to that
sig { returns(T.untyped) }
def create
if trace_log?
Dependabot.logger.info(
"Dependabot::PullRequestCreator::create"
)
end

case source.provider
when "github" then github_creator.create
when "gitlab" then gitlab_creator.create
Expand Down Expand Up @@ -269,6 +281,12 @@ def require_up_to_date_base?

sig { returns(Dependabot::PullRequestCreator::Github) }
def github_creator
if trace_log?
Dependabot.logger.info(
"Dependabot::PullRequestCreator::create"
)
end

Github.new(
source: source,
branch_name: branch_namer.new_branch_name,
Expand Down Expand Up @@ -396,8 +414,8 @@ def message

sig { returns(Dependabot::PullRequestCreator::BranchNamer) }
def branch_namer
if Dependabot::Experiments.enabled?(:dedup_branch_names) && existing_branches
Dependabot.logger.debug(
if trace_log?
Dependabot.logger.info(
"Dependabot::PullRequestCreator::branch_namer : #{existing_branches}"
)
end
Expand Down Expand Up @@ -432,6 +450,14 @@ def labeler
),
T.nilable(Dependabot::PullRequestCreator::Labeler)
)

if trace_log?
Dependabot.logger.info(
"Dependabot::PullRequestCreator::branch_namer : #{existing_branches}"
)
end

@labeler
end

sig { returns(T::Boolean) }
Expand All @@ -443,5 +469,10 @@ def includes_security_fixes?
def requirements_changed?(dependency)
(dependency.requirements - T.must(dependency.previous_requirements)).any?
end

sig { returns(T::Boolean) }
def trace_log?
Dependabot::Experiments.enabled?(:dedup_branch_names)
end
end
end

0 comments on commit 1753cd2

Please sign in to comment.