Skip to content

Commit

Permalink
Rename to unused_private_packages
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Apr 4, 2024
1 parent 53ad98b commit b3dc60c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions komodo/check_unused_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def check_for_unused_package(
if metadata.get("source") != "pypi":
dependencies.add_user_specified(name, metadata.get("depends", []))
dependencies.check(public_and_plugin_packages)
diff_packages = set(
unused_private_packages = set(
pkg
for pkg in release_file.content
if package_status[pkg]["visibility"] == "private"
).difference(dependencies.used_packages)
if diff_packages:
if unused_private_packages:
print(
f"The following {len(diff_packages)} private packages are not dependencies of any public or private-plugin packages:"
f"The following {len(unused_private_packages)} private packages are not dependencies of any public or private-plugin packages:"
)
print(", ".join(sorted(list(diff_packages))))
print(", ".join(sorted(list(unused_private_packages))))
print(
"If you have added or removed any packages check that the dependencies in repository.yml are correct."
)
Expand Down
13 changes: 9 additions & 4 deletions komodo/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ def lint(
pypi_dependencies, python_version=python_version
)
for name, version in release_file.content.items():
if "depends" in repository_file.content.get(name, {}).get(version, {}):
dependencies.add_user_specified(
name, repository_file.content[name][version]["depends"]
)
# if "depends" in repository_file.content.get(name, {}).get(version, {}):
if "pypi" != repository_file.content.get(name, {}).get(version, {}).get(
"source"
):
depends = repository_file.content[name][version].get("depends", [])
if depends != []:
dependencies.add_user_specified(
name, repository_file.content[name][version]["depends"]
)

dependencies.check()
if dependencies.failed_requirements:
Expand Down

0 comments on commit b3dc60c

Please sign in to comment.