Skip to content

Commit

Permalink
Push the ungrouped semvar deps into the engine as implementation detail
Browse files Browse the repository at this point in the history
  • Loading branch information
brrygrdn committed Jul 31, 2023
1 parent e281903 commit f5ad775
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
40 changes: 22 additions & 18 deletions updater/lib/dependabot/dependency_group_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.from_job_config(job:)
new(dependency_groups: groups)
end

attr_reader :dependency_groups, :groups_calculated, :ungrouped_dependencies
attr_reader :dependency_groups, :groups_calculated

def find_group(name:)
dependency_groups.find { |group| group.name == name }
Expand Down Expand Up @@ -56,23 +56,8 @@ def assign_to_groups!(dependencies:)
@groups_calculated = true
end

# TODO: Limit the dependency set to those we know have passed-over updates
#
# This will make a second update attempt on every dependency in any groups
# which do not permit highest version avaliable upgrades.
#
# We can be smarter about this since the versions available will need
# to be checked at least once prior to this set being evaluated.
#
# It will require us to start evaluating the DependencyGroup inside the
# UpdaterChecker and expose methods for the highest resolvable version
# both with and without the group's ignore rules.
#
# I'd rather ship this change separately once we've proved this run schema
# works as expected in terms of creating both group and single PRs which do
# not interfere with each other.
def dependencies_with_ungrouped_semvar_levels
dependency_groups.reject(&:targets_highest_versions_possible?).map(&:dependencies).flatten
def ungrouped_dependencies
@ungrouped_dependencies + dependencies_with_ungrouped_semvar_levels
end

private
Expand All @@ -99,5 +84,24 @@ def warn_misconfigured_groups(groups)
- the dependencies that match the group rules have been removed from your project
WARN
end

# TODO: Limit the dependency set to those we know have passed-over updates
#
# This will make a second update attempt on every dependency in any groups
# which do not permit highest version avaliable upgrades.
#
# We can be smarter about this since the versions available will need
# to be checked at least once prior to this set being evaluated.
#
# It will require us to start evaluating the DependencyGroup inside the
# UpdaterChecker and expose methods for the highest resolvable version
# both with and without the group's ignore rules.
#
# I'd rather ship this change separately once we've proved this run schema
# works as expected in terms of creating both group and single PRs which do
# not interfere with each other.
def dependencies_with_ungrouped_semvar_levels
dependency_groups.reject(&:targets_highest_versions_possible?).map(&:dependencies).flatten
end
end
end
3 changes: 1 addition & 2 deletions updater/lib/dependabot/dependency_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ def ungrouped_dependencies
# If no groups are defined, all dependencies are ungrouped by default.
return allowed_dependencies unless groups.any?

@dependency_group_engine.ungrouped_dependencies +
@dependency_group_engine.dependencies_with_ungrouped_semvar_levels
@dependency_group_engine.ungrouped_dependencies
end

private
Expand Down

0 comments on commit f5ad775

Please sign in to comment.