Skip to content

Commit

Permalink
Fix showing bundler v1 deprecation warnings in PR message and logs (#…
Browse files Browse the repository at this point in the history
…10554)

* fixed bugs related to pr message markdown and logging.
  • Loading branch information
kbukum1 authored Sep 5, 2024
1 parent aad1a7e commit efdfe8e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions common/lib/dependabot/notices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def self.markdown_from_description(notice)
line = line.strip
markdown += "> #{line}\n"
end
markdown += ">\n\n"
markdown
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ def commits_details(base:, head:)
end
end

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
end

after do
Dependabot::Experiments.reset!
end

describe "#pr_name" do
subject(:pr_name) { builder.pr_name }

Expand Down
9 changes: 5 additions & 4 deletions updater/lib/dependabot/notices_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,21 @@ def add_deprecation_notice(notices:, package_manager:)

sig { params(notice: Dependabot::Notice).void }
def log_notice(notice)
logger = Dependabot.logger
# Log each non-empty line of the deprecation notice description
notice.description.each_line do |line|
line = line.strip
next if line.empty?

case notice.mode
when Dependabot::Notice::NoticeMode::INFO
return Dependabot.logger.info(line)
logger.info(line)
when Dependabot::Notice::NoticeMode::WARN
Dependabot.logger.warn(line)
logger.warn(line)
when Dependabot::Notice::NoticeMode::ERROR
Dependabot.logger.error(line)
logger.error(line)
else
Dependabot.logger.info(line)
logger.info(line)
end
end
end
Expand Down

0 comments on commit efdfe8e

Please sign in to comment.