(*, location: ScanLocation)
| 28 | |
| 29 | |
| 30 | def analyzer_poetry_lock(*, location: ScanLocation): |
| 31 | lock = parse_toml(location.location.read_text()) |
| 32 | |
| 33 | for pkg in lock["package"]: |
| 34 | pkg_version = Version(pkg["version"]) |
| 35 | pkg_name = str(pkg["name"]) |
| 36 | |
| 37 | try: |
| 38 | pypi = package.PypiPackage.from_cached(pkg_name) |
| 39 | latest = Version(pypi.get_latest_release()) |
| 40 | |
| 41 | if latest > pkg_version: |
| 42 | yield Detection( |
| 43 | detection_type="OutdatedPackage", |
| 44 | message=f"Package {pkg_name}=={pkg_version} in poetry.lock is outdated, newest version is {latest}", |
| 45 | signature=f"outpdate_pkg#{str(location)}#{pkg_name}#{pkg_version}", |
| 46 | score=get_score_or_default("requirement-outdated", 5), |
| 47 | location=location.location, |
| 48 | extra={ |
| 49 | "package": pkg_name, |
| 50 | "specs": f"=={pkg_version}", |
| 51 | "latest": str(latest) |
| 52 | }, |
| 53 | tags={"outdated_package"} |
| 54 | ) |
| 55 | except NoSuchPackage: |
| 56 | pass |
no test coverage detected