Skip to content

Commit 37d102c

Browse files
committed
lint
1 parent 44124bb commit 37d102c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

app/utils/repo_analyzer/repo_analyzer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from glob import glob
2-
from os import makedirs, system
2+
from os import makedirs
33
from os.path import exists, isdir, join
44
from shutil import rmtree
55

@@ -30,7 +30,6 @@
3030
cargo_files = ["Cargo.toml", "Cargo.lock"]
3131
all_files = set(pypi_files + npm_files + maven_files + nuget_files + ruby_files + cargo_files)
3232

33-
3433
async def repo_analyzer(owner: str, name: str) -> dict[str, dict[str, dict | str]]:
3534
requirement_files: dict[str, dict[str, dict | str]] = {}
3635
repository_path = await download_repository(owner, name)
@@ -84,12 +83,12 @@ async def repo_analyzer(owner: str, name: str) -> dict[str, dict[str, dict | str
8483
requirement_files = await analyze_cargo_lock(
8584
requirement_files, repository_path, requirement_file_name
8685
)
87-
system("rm -rf " + repository_path)
86+
rmtree(repository_path)
8887
return requirement_files
8988

9089

9190
async def download_repository(owner: str, name: str) -> str:
92-
repository_path = f"repositories/{name}"
91+
repository_path = f"repositories/{owner}/{name}"
9392
if exists(repository_path):
9493
rmtree(repository_path)
9594
makedirs(repository_path)
@@ -100,7 +99,7 @@ async def download_repository(owner: str, name: str) -> str:
10099
return repository_path
101100
contents = await resp.json()
102101
for item in contents:
103-
if item["type"] == "file" and item["name"] in all_files:
102+
if item["type"] == "file" and any(extension in item["name"] for extension in all_files):
104103
raw_url = item["download_url"]
105104
async with session.get(raw_url) as file_resp:
106105
if file_resp.status == 200:

0 commit comments

Comments
 (0)