Skip to content

[K9VULN-11396] do not panic when reading gitignore#808

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intomainfrom
julien/K9VULN-11396
Feb 9, 2026
Merged

[K9VULN-11396] do not panic when reading gitignore#808
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intomainfrom
julien/K9VULN-11396

Conversation

@juli1
Copy link
Collaborator

@juli1 juli1 commented Feb 6, 2026

What problem are you trying to solve?

Do not panic when there are non-utf8 characters in the .gitignore file

What is your solution?

Print an error message

@juli1 juli1 requested a review from a team as a code owner February 6, 2026 19:53
@datadog-official
Copy link

datadog-official bot commented Feb 6, 2026

🎯 Code Coverage
Patch Coverage: 18.18%
Overall Coverage: 84.79% (-0.03%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0ab949c | Docs | Datadog PR Page | Was this helpful? Give us feedback!

Copy link
Collaborator

@jasonforal jasonforal left a comment

Choose a reason for hiding this comment

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

In addition to the suggested change, you should bring back the analyzer/git hook changes you made that removed .expect, e.g.

.expect("error when reading gitignore file");

In favor of anyhow's context conversion like

.context("error when reading gitignore file")?; 

let lines = reader
.lines()
.map(String::from)
.map_while(Result::ok)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be flatten() (or filter_map(Result::ok) if you prefer that style) so we just discard the offending lines. map_while will halt iteration at that point, leading to a half-parsed file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

.flatten() is rejected by rust-clippy, I used the map_while because of the recommendation.

@juli1 juli1 requested a review from jasonforal February 6, 2026 23:12
@juli1
Copy link
Collaborator Author

juli1 commented Feb 9, 2026

/merge

@gh-worker-devflow-routing-ef8351
Copy link

gh-worker-devflow-routing-ef8351 bot commented Feb 9, 2026

View all feedbacks in Devflow UI.

2026-02-09 14:58:55 UTC ℹ️ Start processing command /merge


2026-02-09 14:59:03 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 24m (p90).


2026-02-09 15:18:52 UTC ℹ️ MergeQueue: This merge request was merged

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants