Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow GitCommitChecker to check subdependencies too #7464

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow subdependencies to have an associated git source
Since in Swift all dependencies (including subdependencies) are usually
git dependencies, it's convenient to save the git repository URL during
parsing in the dependency, and then be able to use `GitCommitChecker`
from that URL.
  • Loading branch information
deivid-rodriguez committed Jul 17, 2023
commit e19b4ab43cd87ce5f7ddc25a489a9f2b1c9e0907
12 changes: 11 additions & 1 deletion common/lib/dependabot/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def version_class
end

def source_details(allowed_types: nil)
sources = requirements.map { |requirement| requirement.fetch(:source) }.uniq.compact
sources = all_sources.uniq.compact
sources.select! { |source| allowed_types.include?(source[:type].to_s) } if allowed_types

git = allowed_types == ["git"]
Expand All @@ -231,6 +231,16 @@ def source_type
details[:type] || details.fetch("type")
end

def all_sources
if top_level?
requirements.map { |requirement| requirement.fetch(:source) }
elsif subdependency_metadata
subdependency_metadata.filter_map { |data| data[:source] }
else
[]
end
end

private

def check_values
Expand Down