Skip to content

Fix CRAN DESCRIPTION Depends parsing and missing-field crashes #5369 - #5370

Open
syahra712 wants to merge 1 commit into
aboutcode-org:developfrom
syahra712:fix/cran-description-depends
Open

syahra712 wants to merge 1 commit into
aboutcode-org:developfrom
syahra712:fix/cran-description-depends

Conversation

@syahra712

Copy link
Copy Markdown
Contributor

Fixes #5369

The CRAN DESCRIPTION parser now:

  • splits Depends on every comma, so R (>= 3.4.0), methods, utils gives three dependencies (R with >= 3.4.0, methods, utils with >= 3.0) instead of one R dependency with a garbled requirement;
  • skips empty entries, so a file with no Depends field returns no dependencies instead of raising ValueError: Invalid purl;
  • returns (None, None) from get_party_info for an empty value, so a file without Author or Maintainer (common in source packages that only have Authors@R) no longer raises TypeError.

Tests: two new fixtures (cran/single-line-depends, cran/no-depends) and a unit test for the new get_dependencies helper. All three tests fail on develop and pass with this change. The existing codetools and geometry expectations are unchanged.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- pytest tests/packagedcode/test_cran.py (5 passed)
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

…ode-org#5369

Split Depends on every comma so a single-line field such as
"R (>= 3.4.0), methods, utils" yields one dependency per package
instead of a single R dependency with a garbled requirement.
Skip empty entries so a missing Depends field no longer creates an
invalid purl, and make get_party_info return (None, None) so a
DESCRIPTION without Author or Maintainer no longer crashes.

Signed-off-by: 72004 <syahra2014@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRAN DESCRIPTION parser drops single-line Depends entries and crashes without Depends or Author/Maintainer

1 participant