Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
GitHub Codeowners unanchored directory pattern matches directories at all levels leading slash root only💡 Result:
GitHub CODEOWNERS patterns follow most rules used in gitignore files, but their directory matching behavior depends on how they are anchored and whether wildcards are used [1][2][3]. A pattern is anchored to the root of the repository if it starts with a leading slash (/) [3]. Patterns without a leading slash are unanchored and match at any depth in the repository [3][4]. Regarding directory matching: 1. Unanchored directory patterns: A pattern like
dir/(without a leading slash) matches a directory nameddirat any level in the repository hierarchy [3][4]. 2. The*wildcard limit: A pattern using a single asterisk, such asdocs/*, matches files directly within the specified directory but does not recursively match files in nested subdirectories [1][5]. This is consistent with how gitignore handles single-level globbing [6]. 3. Recursive matching: To match all files and subdirectories within a directory at any depth, you must use the double asterisk syntax (e.g.,docs/) [6][3][5]. In summary, an unanchored pattern does not restrict matching to the root; it matches anywhere in the repository [3]. However, simply naming a directory followed by/*will not provide the recursive matching behavior that users often expect for directory trees; for that,/is required [1][6][3][5].Citations:
Anchor repository-root paths.
If these rules target only root-level configuration and tooling, add
/before each rooted path. Unanchored directory patterns match the same directory name anywhere in the repository.Proposed fix
🤖 Prompt for AI Agents