Skip to content

Commit

Permalink
Fixes pip-compile file matcher for metric collection (#11174)
Browse files Browse the repository at this point in the history
Fixes pip-compile file matcher for metric collection (#11174)
  • Loading branch information
sachin-sandhu authored Dec 27, 2024
1 parent c0b00ef commit c1d2edc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
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) }
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

0 comments on commit c1d2edc

Please sign in to comment.