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

Fix panic when parsing unattached comment #565

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

charithe
Copy link
Contributor

@charithe charithe commented Dec 2, 2024

After the parser refactor, there's a panic when a comment exists on its own without anything to attach it to. This PR fixes that case.

Before submitting your PR, please confirm the following.

  • Describe the purpose for which you created this PR.
  • Create test code that corresponds to the modification

The parser panics when there's a comment without anything to attach it
to. This PR fixes that case.

Signed-off-by: Charith Ellawala <charith@cerbos.dev>
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.46%. Comparing base (2ab584e) to head (8751a57).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #565   +/-   ##
=======================================
  Coverage   77.45%   77.46%           
=======================================
  Files          21       21           
  Lines        7479     7482    +3     
=======================================
+ Hits         5793     5796    +3     
  Misses       1291     1291           
  Partials      395      395           

charithe added a commit to charithe/cerbos that referenced this pull request Dec 2, 2024
Requires patch from goccy/go-yaml#565.

Fixes cerbos#2401

Signed-off-by: Charith Ellawala <charith@cerbos.dev>
parser/parser.go Outdated Show resolved Hide resolved
parser/parser.go Outdated Show resolved Hide resolved
Copy link
Owner

@goccy goccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution ! I've submitted review

Signed-off-by: Charith Ellawala <charith@cerbos.dev>
Signed-off-by: Charith Ellawala <charith@cerbos.dev>
@charithe charithe requested a review from goccy December 2, 2024 14:41
@goccy goccy merged commit 5d22eed into goccy:master Dec 2, 2024
19 checks passed
@charithe charithe deleted the fix-unattached-comment branch December 2, 2024 15:21
charithe added a commit to cerbos/cerbos that referenced this pull request Dec 2, 2024
Requires patch from goccy/go-yaml#565.

Fixes #2401

Signed-off-by: Charith Ellawala <charith@cerbos.dev>

---------

Signed-off-by: Charith Ellawala <charith@cerbos.dev>
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.

3 participants