Skip to content

Conversation

@perryqh
Copy link
Contributor

@perryqh perryqh commented Aug 22, 2025

Added --json for the for-file command

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds JSON output support to the for-file command by introducing a --json flag that formats ownership information as structured JSON instead of plain text.

  • Added --json flag to the for-file command in CLI
  • Implemented JSON serialization for file ownership results
  • Updated existing methods to handle both text and JSON output formats

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/cli.rs Added --json flag parameter to ForFile command
src/runner/api.rs Updated for_file function signature to accept json parameter
src/runner.rs Added JSON serialization logic and ForFileResult struct
src/ownership.rs Modified Display formatting for FileOwner to handle empty sources
src/runner/types.rs Added Serialize derive to Error enum and moved has_errors method
tests/valid_project_test.rs Added test cases for JSON output with valid projects
tests/invalid_project_test.rs Added test cases for JSON output with invalid projects

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perryqh perryqh force-pushed the ph.for-file-json branch 3 times, most recently from 53e5001 to 0c7aa5b Compare August 22, 2025 23:15
})
.collect::<Result<_, IoError>>()
.map_err(|e| Box::new(e) as Box<dyn Error>)?;
let codeowners_entries = parse_codeowners_entries(self.codeowners_file_path.to_string_lossy().into_owned());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little refactoring for clarity

Copy link
Contributor

@jackboberg jackboberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected 👍

@perryqh perryqh merged commit cc9a387 into main Aug 25, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from Triage to Done in Modularity Aug 25, 2025
@perryqh perryqh deleted the ph.for-file-json branch September 5, 2025 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants