-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add support for hex ecosystem metrics collection #11023
Open
amazimbe
wants to merge
3
commits into
main
Choose a base branch
from
amazimbe/hex-ecosystem-metrics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+214
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/ecosystem" | ||
require "dependabot/hex/version" | ||
|
||
module Dependabot | ||
module Hex | ||
LANGUAGE = "elixir" | ||
|
||
class Language < Dependabot::Ecosystem::VersionManager | ||
extend T::Sig | ||
|
||
sig { params(raw_version: String).void } | ||
def initialize(raw_version) | ||
super(LANGUAGE, Version.new(raw_version)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/ecosystem" | ||
require "dependabot/hex/version" | ||
|
||
module Dependabot | ||
module Hex | ||
ECOSYSTEM = "hex" | ||
PACKAGE_MANAGER = "hex" | ||
SUPPORTED_HEX_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version]) | ||
|
||
# When a version is going to be unsupported, it will be added here | ||
DEPRECATED_HEX_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version]) | ||
|
||
class PackageManager < Dependabot::Ecosystem::VersionManager | ||
extend T::Sig | ||
|
||
sig { params(raw_version: String).void } | ||
def initialize(raw_version) | ||
super( | ||
PACKAGE_MANAGER, | ||
Version.new(raw_version), | ||
DEPRECATED_HEX_VERSIONS, | ||
SUPPORTED_HEX_VERSIONS | ||
) | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def deprecated? | ||
false | ||
end | ||
|
||
sig { returns(T::Boolean) } | ||
def unsupported? | ||
false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/hex/language" | ||
require "dependabot/ecosystem" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::Hex::Language do | ||
subject(:language) { described_class.new(version) } | ||
|
||
let(:version) { "1.17.3" } | ||
|
||
describe "#version" do | ||
it "returns the version" do | ||
expect(language.version).to eq(Dependabot::Hex::Version.new(version)) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the name" do | ||
expect(language.name).to eq(Dependabot::Hex::LANGUAGE) | ||
end | ||
end | ||
|
||
describe "#unsupported?" do | ||
it "returns false by default" do | ||
expect(language.unsupported?).to be false | ||
end | ||
end | ||
|
||
describe "#deprecated?" do | ||
it "returns false by default" do | ||
expect(language.deprecated?).to be false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/hex/package_manager" | ||
require "dependabot/ecosystem" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::Hex::PackageManager do | ||
subject(:package_manager) { described_class.new(version) } | ||
|
||
let(:version) { "2.1.1" } | ||
|
||
describe "#version" do | ||
it "returns the version" do | ||
expect(package_manager.version).to eq(Dependabot::Hex::Version.new(version)) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the name" do | ||
expect(package_manager.name).to eq(Dependabot::Hex::PACKAGE_MANAGER) | ||
end | ||
end | ||
|
||
describe "#deprecated_versions" do | ||
it "returns deprecated versions" do | ||
expect(package_manager.deprecated_versions).to eq(Dependabot::Hex::DEPRECATED_HEX_VERSIONS) | ||
end | ||
end | ||
|
||
describe "#supported_versions" do | ||
it "returns supported versions" do | ||
expect(package_manager.supported_versions).to eq(Dependabot::Hex::SUPPORTED_HEX_VERSIONS) | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to be a pattern, should this be a constant across ecosystems? Tagging @kbukum1 too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. It is ecosystem specific and even within the ecosystem the prefixes are different. One starts with hex, the package manager, and the other starts with elixir the language.