Skip to content
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

Fixes pip-compile file matcher for metric collection #11174

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/lib/dependabot/python/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FileParser < Dependabot::FileParsers::Base
require_relative "file_parser/pipfile_files_parser"
require_relative "file_parser/pyproject_files_parser"
require_relative "file_parser/setup_file_parser"
require_relative "file_parser/python_requirement_parser"

DEPENDENCY_GROUP_KEYS = [
{
Expand Down Expand Up @@ -337,7 +338,7 @@ def check_requirements(requirements)
end

def pipcompile_in_file
requirement_files.any? { |f| f.end_with?(".in") }
requirement_files.any? { |f| f.name.end_with?(PipCompilePackageManager::MANIFEST_FILENAME) }
sachin-sandhu marked this conversation as resolved.
Show resolved Hide resolved
end

def pipenv_files
Expand Down
1 change: 1 addition & 0 deletions python/lib/dependabot/python/package_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class PipCompilePackageManager < Dependabot::Ecosystem::VersionManager
extend T::Sig

NAME = "pip-compile"
MANIFEST_FILENAME = ".in"

SUPPORTED_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version])

Expand Down
8 changes: 8 additions & 0 deletions python/spec/dependabot/python/file_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,14 @@
)
end
end

it "returns the correct ecosystem and package manager set" do
ecosystem = parser.ecosystem

expect(ecosystem.name).to eq("Python")
expect(ecosystem.package_manager.name).to eq("pip-compile")
expect(ecosystem.language.name).to eq("python")
end
end
end

Expand Down
Loading