Skip to main content

CodeOwnersProvider

Trait CodeOwnersProvider 

Source
pub trait CodeOwnersProvider: Send + Sync {
    // Required methods
    fn output_path(&self) -> &str;
    fn section_style(&self) -> SectionStyle;
    fn sync(
        &self,
        repo_root: &Path,
        projects: &[ProjectOwners],
        dry_run: bool,
    ) -> Result<SyncResult>;
    fn check(
        &self,
        repo_root: &Path,
        projects: &[ProjectOwners],
    ) -> Result<CheckResult>;
}
Expand description

Trait for CODEOWNERS sync providers.

Each platform implements this trait to provide platform-specific sync behavior. Implementations determine the output path and section formatting style.

Required Methods§

Source

fn output_path(&self) -> &str

Get the output path for the CODEOWNERS file.

Examples: .github/CODEOWNERS (GitHub), CODEOWNERS (GitLab)

Source

fn section_style(&self) -> SectionStyle

Get the section formatting style.

Source

fn sync( &self, repo_root: &Path, projects: &[ProjectOwners], dry_run: bool, ) -> Result<SyncResult>

Sync CODEOWNERS from project configurations.

Aggregates ownership rules from all projects and writes the appropriate CODEOWNERS file(s) for this platform.

§Arguments
  • repo_root - Root directory of the repository
  • projects - List of projects with their ownership configurations
  • dry_run - If true, don’t write files, just report what would happen
§Errors

Returns an error if file operations fail or configuration is invalid.

Source

fn check( &self, repo_root: &Path, projects: &[ProjectOwners], ) -> Result<CheckResult>

Check if CODEOWNERS is in sync with configuration.

§Arguments
  • repo_root - Root directory of the repository
  • projects - List of projects with their ownership configurations
§Errors

Returns an error if file operations fail or configuration is invalid.

Implementors§