Skip to content

Commit

Permalink
Filter out all support files from evaled_gemfiles() without listing e…
Browse files Browse the repository at this point in the history
…ach pattern separately
  • Loading branch information
kpumuk committed Mar 2, 2024
1 parent 72a48f1 commit 34af3a4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
5 changes: 1 addition & 4 deletions bundler/lib/dependabot/bundler/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,9 @@ def evaled_gemfiles
dependency_files
.reject { |f| f.name.end_with?(".gemspec") }
.reject { |f| f.name.end_with?(".specification") }
.reject { |f| f.name.end_with?(".lock") }
.reject { |f| f.name.end_with?(".ruby-version") }
.reject { |f| f.name.end_with?(".tool-versions") }
.reject { |f| f.name == "Gemfile" }
.reject { |f| f.name == "gems.rb" }
.reject { |f| f.name == "gems.locked" }
.reject(&:support_file?)
end

def lockfile
Expand Down
5 changes: 1 addition & 4 deletions bundler/lib/dependabot/bundler/file_parser/file_preparer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ def evaled_gemfiles
dependency_files
.reject { |f| f.name.end_with?(".gemspec") }
.reject { |f| f.name.end_with?(".specification") }
.reject { |f| f.name.end_with?(".lock") }
.reject { |f| f.name.end_with?(".ruby-version") }
.reject { |f| f.name.end_with?(".tool-versions") }
.reject { |f| f.name == "Gemfile" }
.reject { |f| f.name == "gems.rb" }
.reject { |f| f.name == "gems.locked" }
.reject(&:support_file?)
end

def specification_files
Expand Down
5 changes: 1 addition & 4 deletions bundler/lib/dependabot/bundler/file_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,9 @@ def evaled_gemfiles
dependency_files
.reject { |f| f.name.end_with?(".gemspec") }
.reject { |f| f.name.end_with?(".specification") }
.reject { |f| f.name.end_with?(".lock") }
.reject { |f| f.name.end_with?(".ruby-version") }
.reject { |f| f.name.end_with?(".tool-versions") }
.reject { |f| f.name == "Gemfile" }
.reject { |f| f.name == "gems.rb" }
.reject { |f| f.name == "gems.locked" }
.reject(&:support_file?)
end

def updated_gemfile_content(file)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,8 @@ def evaled_gemfiles
dependency_files
.reject { |f| f.name.end_with?(".gemspec") }
.reject { |f| f.name.end_with?(".specification") }
.reject { |f| f.name.end_with?(".lock") }
.reject { |f| f.name.end_with?(".ruby-version") }
.reject { |f| f.name.end_with?(".tool-versions") }
.reject { |f| f.name == "Gemfile" }
.reject { |f| f.name == "gems.rb" }
.reject { |f| f.name == "gems.locked" }
.reject(&:support_file?)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,9 @@ def evaled_gemfiles
dependency_files
.reject { |f| f.name.end_with?(".gemspec") }
.reject { |f| f.name.end_with?(".specification") }
.reject { |f| f.name.end_with?(".lock") }
.reject { |f| f.name.end_with?(".ruby-version") }
.reject { |f| f.name.end_with?(".tool-versions") }
.reject { |f| f.name == "Gemfile" }
.reject { |f| f.name == "gems.rb" }
.reject { |f| f.name == "gems.locked" }
.reject(&:support_file?)
end

def lockfile
Expand Down
5 changes: 5 additions & 0 deletions bundler/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def self.bundler_version

def bundler_project_dependency_files(project, directory: "/")
project_dependency_files(File.join("bundler#{PackageManagerHelper.bundler_version}", project), directory: directory)
.each do |dep|
dep.support_file =
dep.name.end_with?(".lock", ".ruby-version", ".tool-versions") ||
dep.name == "gems.locked"
end
end

def bundler_project_dependency_file(project, filename:)
Expand Down

0 comments on commit 34af3a4

Please sign in to comment.