Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.21 KB

README.md

File metadata and controls

39 lines (28 loc) · 1.21 KB

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

<?php

use CodeOwners\Parser;
use CodeOwners\PatternMatcher;

try {
    $patterns = (new Parser())->parse($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
}

Known limitations

Currently the library does not handle spaces in file paths.