Skip to content

Commit

Permalink
Merge pull request #7146 from yeikel/maven/feat-3845
Browse files Browse the repository at this point in the history
feat(maven): use `groupId` and `artifactId` for the dependency name
  • Loading branch information
jurre authored Jul 20, 2023
2 parents bafad1b + fdf8f83 commit 8919de6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion maven/lib/dependabot/maven.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"maven",
lambda { |name|
_group_id, artifact_id, _classifier = name.split(":")
%w(bom library).include?(artifact_id) ? name : artifact_id
name.length <= 100 ? name : artifact_id
}
)
11 changes: 8 additions & 3 deletions maven/spec/dependabot/maven_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@
end

context "normal dependency" do
let(:name) { "group.com:dep" }
let(:name) { "group.com:dep:mule-plugin" }

it { is_expected.to eq("dep") }
it { is_expected.to eq("group.com:dep:mule-plugin") }
end

context "dependency with classifier" do
let(:name) { "group.com:dep:mule-plugin" }

it { is_expected.to eq("dep") }
it { is_expected.to eq("group.com:dep:mule-plugin") }
end

context "with a special-cased name" do
let(:name) { "group.com:bom" }

it { is_expected.to eq("group.com:bom") }
end

context "with a 100+ character name" do
let(:name) { "com.long-domain-name-that-should-be-replaced-by-ellipsis.this-is-longer-group-id:the-longest-artifact-id" } # rubocop:disable Layout/LineLength
it { is_expected.to eq("the-longest-artifact-id") }
end
end
end

0 comments on commit 8919de6

Please sign in to comment.