[SDTEST-3516] fix codeowners parser#199
Conversation
There was a problem hiding this comment.
Pull request overview
This PR rewrites the CODEOWNERS file parser to use regex-based pattern matching instead of the previous simple string matching approach. The new implementation generates NSRegularExpression patterns from CODEOWNERS glob syntax, supporting features like ** directory matching, ? wildcard, character ranges [...], negated patterns !, escape sequences, GitLab-style sections with approval counts, and section default owners.
Changes:
- Replaced the old
CodeOwnersparser with a new regex-based implementation using aSlidingWindowpattern compiler that converts CODEOWNERS glob patterns toNSRegularExpression - Changed the
CodeOwnersinitializers from failable (init?) to throwing (throws(ParsingError)) with a new typed error enum - Added comprehensive tests ported from the Ruby datadog-ci-rb matcher spec, covering edge cases like escaped characters, Unicode paths, character ranges, and section exclusion semantics
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Sources/DatadogSDKTesting/Utils/CodeOwners.swift | Complete rewrite of CODEOWNERS parser: new SlidingWindow-based pattern compiler generating NSRegularExpression from globs, support for sections, negation, character ranges, and escape sequences |
| Tests/DatadogSDKTesting/Utils/CodeOwnersTests.swift | Updated existing tests for new API, added extensive new test classes covering matcher spec, parser edge cases, character ranges, Unicode paths, and escape handling |
| Sources/DatadogSDKTesting/DDTestMonitor.swift | Updated caller to handle throwing initializer with do-catch instead of optional return |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@ypopovych I've opened a new pull request, #200, to work on those changes. Once the pull request is ready, I'll request review from you. |
Remove unused `index` parameter from `_isSectionHeader` Co-authored-by: ypopovych <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ypopovych <[email protected]>
What and why?
Implemented new CODEOWNERS parser for better path mathing support.
How?
By generating Regex statements for globs
Review checklist