Skip to content

Commit

Permalink
Update how we record Bundler versions
Browse files Browse the repository at this point in the history
We rely on this information for metrics, not application logic. I
believe we're receiving poor information and making decisions based on
it. I'm updating this to see if we're indeed supporting as many Bundler
v1 projects as it seems.
  • Loading branch information
landongrindheim committed Apr 9, 2024
1 parent a3dba8f commit 8c2fe2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bundler/lib/dependabot/bundler/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def self.detected_bundler_version(lockfile)
return "unknown" unless lockfile

if (matches = lockfile.content.match(BUNDLER_MAJOR_VERSION_REGEX))
matches[:version]
matches[:version].to_i
else
"1"
"unknown"
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions bundler/spec/dependabot/bundler/helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def described_method(lockfile)
expect(described_method(no_lockfile)).to eql("unknown")
end

it "is 1 if there is no bundled with string" do
expect(described_method(lockfile_bundled_with_missing)).to eql("1")
it "is unknown if there is no bundled with string" do
expect(described_method(lockfile_bundled_with_missing)).to eql("unknown")
end

it "is 1 if it was bundled with a v1.x version" do
Expand All @@ -88,7 +88,7 @@ def described_method(lockfile)
expect(described_method(lockfile_bundled_with_v2)).to eql("2")
end

it "is 1 if it was bundled with a future version" do
it "reports the version if it was bundled with a future version" do
expect(described_method(lockfile_bundled_with_future_version)).to eql("3")
end
end
Expand Down

0 comments on commit 8c2fe2d

Please sign in to comment.