Skip to content

Commit

Permalink
RuboCop
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Sep 15, 2022
1 parent a891921 commit 954e0d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
Expand Up @@ -116,12 +116,12 @@ def parse_requirements_from(req, type)
end

def using_poetry?
!parsed_pyproject.dig("tool", "poetry").nil?
end
!parsed_pyproject.dig("tool", "poetry").nil?
end

def using_pep621?
!parsed_pyproject.dig("project", "dependencies").nil?
end
def using_pep621?
!parsed_pyproject.dig("project", "dependencies").nil?
end

# Create a DependencySet where each element has no requirement. Any
# requirements will be added when combining the DependencySet with
Expand Down
8 changes: 3 additions & 5 deletions python/lib/dependabot/python/file_updater.rb
Expand Up @@ -64,11 +64,9 @@ def resolver_type
return :pipfile if changed_req_files.any?("Pipfile")

if changed_req_files.any?("pyproject.toml")
if poetry_based?
return :poetry
else
return :requirements
end
return :poetry if poetry_based?

return :requirements
end

return :pip_compile if changed_req_files.any? { |f| f.end_with?(".in") }
Expand Down
14 changes: 7 additions & 7 deletions python/lib/dependabot/python/update_checker.rb
Expand Up @@ -145,13 +145,7 @@ def resolver_type
# which resolver to use based on the filename of its requirements
return :pipenv if req_files.any?("Pipfile")

if req_files.any?("pyproject.toml")
if poetry_based?
return :poetry
else
return :requirements
end
end
return pyproject_resolver if req_files.any?("pyproject.toml")

return :pip_compile if req_files.any? { |f| f.end_with?(".in") }

Expand All @@ -170,6 +164,12 @@ def subdependency_resolver
raise "Claimed to be a sub-dependency, but no lockfile exists!"
end

def pyproject_resolver
return :poetry if poetry_based?

:requirements
end

def exact_requirement?(reqs)
reqs = reqs.map { |r| r.fetch(:requirement) }
reqs = reqs.compact
Expand Down

0 comments on commit 954e0d6

Please sign in to comment.