Skip to content

Commit

Permalink
fix(dependency_getter): stricten URL guessing
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed Mar 6, 2024
1 parent bd78e3e commit 77b5915
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deptry/dependency_getter/requirements_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _check_if_dependency_is_conditional(line: str) -> bool:

@staticmethod
def _line_is_url(line: str) -> Match[str] | None:
return re.search(r"^(http|https|git\+https)", line)
return re.search(r"^(http|https|git\+https)://", line)

@staticmethod
def _extract_name_from_url(line: str) -> str | None:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/dependency_getter/test_requirements_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_parse_requirements_txt(tmp_path: Path) -> None:
docopt == 0.6.1
requests [security] >= 2.8.1, == 2.8.* ; python_version < "2.7"
fox-python
httpx==0.25.2
"""
with run_within_dir(tmp_path):
with Path("requirements.txt").open("w") as f:
Expand All @@ -38,7 +39,7 @@ def test_parse_requirements_txt(tmp_path: Path) -> None:
dependencies_extract = getter.get()
dependencies = dependencies_extract.dependencies

assert len(dependencies) == 18
assert len(dependencies) == 19
assert len(dependencies_extract.dev_dependencies) == 0

assert dependencies[1].name == "colorama"
Expand Down

0 comments on commit 77b5915

Please sign in to comment.