Codeowners
A parser and matcher for the codeowners file as used by Github, Gitlab and Bitbucket.
Install / Use
/learn @timoschinkel/CodeownersREADME
Code owners
Code Owners allows you to parse code owners files and apply the outcome to all kinds of different result sets ranging from code coverage to static analysis results.
Code Owners files are supported by Github, Gitlab and Bitbucket.
Installation
Use Composer for installation:
composer require timoschinkel/codeowners
Usage
Parse CODEOWNERS file:
<?php
use CodeOwners\Parser;
use CodeOwners\PatternMatcher;
try {
$patterns = (new Parser())->parseFile($filename);
$pattern = (new PatternMatcher(...$patterns))->match($filename);
} catch (\CodeOwners\Exception\UnableToParseException $exception) {
// unable to read or parse file
} catch (\CodeOwners\Exception\NoMatchFoundException $exception) {
// no match found
}
Alternatively, parsing a string directly is also supported:
<?php
use CodeOwners\Parser;
use CodeOwners\PatternMatcher;
try {
$patterns = (new Parser())->parseString($contents);
$pattern = (new PatternMatcher(...$patterns))->match($filename);
} catch (\CodeOwners\Exception\UnableToParseException $exception) {
// unable to read or parse file
} catch (\CodeOwners\Exception\NoMatchFoundException $exception) {
// no match found
}
Known limitations
Currently the library does not handle spaces in file paths.
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
