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/python/update_checker/latest_version_finder.rb', line 30
def latest_version_tag(git_commit_checker:)
return git_commit_checker.local_tag_for_latest_version unless cooldown_enabled?
allowed_version_tags = git_commit_checker.local_tags_for_allowed_versions
tags_in_cooldown = select_version_tags_in_cooldown_period(git_commit_checker)
return max_version_from_tags(allowed_version_tags) if tags_in_cooldown.empty?
filtered_tags = allowed_version_tags.reject do |tag|
tags_in_cooldown.include?(tag[:tag])
end
if filtered_tags.empty?
Dependabot.logger.info("All git tags filtered by cooldown for #{dependency.name}, returning nil")
return nil
end
filtered_count = allowed_version_tags.count - filtered_tags.count
if filtered_count.positive?
Dependabot.logger.info("Filtered #{filtered_count} git tags due to cooldown for #{dependency.name}")
end
max_version_from_tags(filtered_tags)
rescue StandardError => e
Dependabot.logger.error("Error fetching latest version tag: #{e.message}")
git_commit_checker.local_tag_for_latest_version
end
|