Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ANE-1827] - Replace "tomland" with "toml-parser" for parsing toml files #1459

Merged
merged 12 commits into from
Aug 16, 2024

Conversation

jagonalez
Copy link
Contributor

@jagonalez jagonalez commented Aug 15, 2024

Overview

  • This PR replaces tomland with toml-parser. The reason for the switch is because tomland has an issue with handling explicit vs implicit tables. toml-parser does not have the same issue.

  • The issue mainly affected poetry toml files, and as shown in ANE-1827 was cuasing CLI to believe there were no dependencies in tool.poetry.dependencies.

  • Switching to toml-parser also seems to resolve an issue with poetry.lock files where keys wrapped in quotes contained the quotes after parsing:

"backports.entry-points-selectable" = [ ... ]

was being recorded as pip+"backports.entry-points-selectable" instead of pip+backports-entry-points-selectable

Acceptance criteria

  • toml files are parsed correctly

Testing plan

  • download the zip file ANE-1827
  • run:
    cabal run fossa -- analyze /path/to/extracted_files -o --only-target poetry | jq -c ".sourceUnits[0].Build.Dependencies"
  • there should be a list of dependencies
  • running the same command using the latest fossa release report no dependencies

Risks

  • toml-parser doesn't provide a way to deal with nested values/tables, so I had to change some of the datatypes to better match the toml formats. However each of them is covered by tests.

Metrics

Is this change something that can or should be tracked? If so, can we do it today? And how? If its easy, do it

References

https://fossa.atlassian.net/browse/ANE-1827

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • If this PR added docs, I added links as appropriate to the user manual's ToC in docs/README.ms and gave consideration to how discoverable or not my documentation is.
  • If this change is externally visible, I updated Changelog.md. If this PR did not mark a release, I added my changes into an # Unreleased section at the top.
  • If I made changes to .fossa.yml or fossa-deps.{json.yml}, I updated docs/references/files/*.schema.json AND I have updated example files used by fossa init command. You may also need to update these if you have added/removed new dependency type (e.g. pip) or analysis target type (e.g. poetry).
  • If I made changes to a subcommand's options, I updated docs/references/subcommands/<subcommand>.md.

@jagonalez jagonalez marked this pull request as ready for review August 16, 2024 17:40
@jagonalez jagonalez requested a review from a team as a code owner August 16, 2024 17:40
@jagonalez jagonalez requested a review from jssblck August 16, 2024 17:40
@jagonalez jagonalez enabled auto-merge (squash) August 16, 2024 21:56
@jagonalez jagonalez merged commit cfbcd5b into master Aug 16, 2024
18 checks passed
@jagonalez jagonalez deleted the jg/ane-1827 branch August 16, 2024 22:13
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.

2 participants