JuliaEcosystem / PackageAnalyzer.jl

https://juliaecosystem.github.io/PackageAnalyzer.jl/dev/
MIT License
59 stars 5 forks source link

Fix for subdirs that doesn't exist at the git repo HEAD #29

Closed ericphanson closed 3 years ago

ericphanson commented 3 years ago

This makes some minimal changes to close #28. We just check that the subdir exists for before looking for licenses / code in it. I also added the subdir to the show method; I think this is good either way since it's interesting to see it's a subdir package, but is particularly important when we can't parse the Project.toml so we don't have a name, and the repo alone doesn't identify the package, ref https://github.com/giordano/AnalyzeRegistry.jl/issues/28#issuecomment-782979547.

julia> analyze_from_registry!(root, find_package("SnoopCompileAnalysis"))
Package Invalid Project.toml:
  * repo: https://github.com/timholy/SnoopCompile.jl.git
    * in subdirectory: SnoopCompileAnalysis
  * uuid: 00000000-0000-0000-0000-000000000000
  * is reachable: true
  * no license found
  * has documentation: false
  * has tests: false
  * has continuous integration: true
    * GitHub Actions

I think a simple fix like this is OK; as I see it, AnalyzeRegistry has two use cases: analyzing a whole registry, in which case a couple unreachable-at-HEAD packages is somewhat expected and it's not that important to go out of our way to find their code, and for analyzing a particular package, in which case the code probably exists or else you wouldn't be looking at it.