CodeOwnersEntry Class
Represents a single line of a CODEOWNERS file, associating a file pattern with its owners.
// Parse a CODEOWNERS file
var file = CodeOwnersFile.Parse("*.js @user1 @user2", CodeOwnersDialect.GitLab);
var entry = file.Entries[0];
Assert.Equal("*.js", entry.Pattern);
Assert.Equal(["@user1", "@user2"], entry.Owners.Select(owner => owner.ToString()));public sealed class CodeOwnersEntry : IEquatable<CodeOwnersEntry>Remarks
Entries are returned in the order they appear in the file. CODEOWNERS resolution is last-match-wins, so the last entry whose CodeOwnersEntry.Pattern matches a path owns it.
- Implements
Properties
| Name | Description |
|---|---|
| IsOptional | Gets a value indicating whether this entry belongs to an optional section. |
| Owners | Gets the owners of the pattern. Empty when the entry explicitly leaves the pattern unowned. |
| Pattern | Gets the file pattern (e.g., "*.js", "/docs/*", or "*") that this entry applies to. |
| Section | Gets the section this entry belongs to, or null if not part of a section. |
IsOptional
CodeOwnersEntry.csOwners
CodeOwnersEntry.csGets the owners of the pattern. Empty when the entry explicitly leaves the pattern unowned.
public IReadOnlyList<CodeOwner> Owners { get; }Property value
Pattern
CodeOwnersEntry.csSection
CodeOwnersEntry.csGets the section this entry belongs to, or null if not part of a section.
public CodeOwnersSection? Section { get; }Property value
Methods
| Name | Description |
|---|---|
| Equals(CodeOwnersEntry?) | |
| Equals(object?) | |
| GetHashCode() | |
| ToString() | Returns the entry as written in a CODEOWNERS file of the dialect it was parsed with: the escaped pattern followed by the owners. |
Equals overloads
Equals(CodeOwnersEntry?)
CodeOwnersEntry.cspublic bool Equals(CodeOwnersEntry? other)No documentation is available.
Equals(object?)
CodeOwnersEntry.csGetHashCode()
CodeOwnersEntry.csToString()
CodeOwnersEntry.csReturns the entry as written in a CODEOWNERS file of the dialect it was parsed with: the escaped pattern followed by the owners.
public override string ToString()Returns
Remarks
The section header is not part of the entry: parse the line after CodeOwnersSection.ToString to read the entry back.
Operators
| Name | Description |
|---|---|
| operator ==(CodeOwnersEntry?, CodeOwnersEntry?) | |
| operator !=(CodeOwnersEntry?, CodeOwnersEntry?) |
operator ==(CodeOwnersEntry?, CodeOwnersEntry?)
CodeOwnersEntry.cspublic static bool operator ==(CodeOwnersEntry? left, CodeOwnersEntry? right)No documentation is available.
operator !=(CodeOwnersEntry?, CodeOwnersEntry?)
CodeOwnersEntry.cspublic static bool operator !=(CodeOwnersEntry? left, CodeOwnersEntry? right)No documentation is available.