From c701bbbee3697693bfcf76f81b543df19c14c848 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Dec 2025 13:31:35 +0000 Subject: [PATCH] Run CSharpier formatting and document check-format process Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com> --- AGENTS.md | 30 ++++++++++++++++--- .../Archives/IArchiveExtensions.cs | 16 ++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c7b4a5a6..ae36265a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,12 +32,34 @@ SharpCompress is a pure C# compression library supporting multiple archive forma - Use CSharpier for code formatting to ensure consistent style across the project - CSharpier is configured as a local tool in `.config/dotnet-tools.json` -- **To format code, run the task: `format` task (which runs `dotnet csharpier .` from project root)** -- Restore tools with: `dotnet tool restore` -- Format files from the project root with: `dotnet csharpier .` -- Configure your IDE to format on save using CSharpier for the best experience + +### Commands + +1. **Restore tools** (first time only): + ```bash + dotnet tool restore + ``` + +2. **Check if files are formatted correctly** (doesn't modify files): + ```bash + dotnet csharpier check . + ``` + - Exit code 0: All files are properly formatted + - Exit code 1: Some files need formatting (will show which files and differences) + +3. **Format files** (modifies files): + ```bash + dotnet csharpier format . + ``` + - Formats all files in the project to match CSharpier style + - Run from project root directory + +4. **Configure your IDE** to format on save using CSharpier for the best experience + +### Additional Notes - The project also uses `.editorconfig` for editor settings (indentation, encoding, etc.) - Let CSharpier handle code style while `.editorconfig` handles editor behavior +- Always run `dotnet csharpier check .` before committing to verify formatting ## Project Setup and Structure diff --git a/src/SharpCompress/Archives/IArchiveExtensions.cs b/src/SharpCompress/Archives/IArchiveExtensions.cs index a0ac9d19..4ab4129b 100644 --- a/src/SharpCompress/Archives/IArchiveExtensions.cs +++ b/src/SharpCompress/Archives/IArchiveExtensions.cs @@ -88,13 +88,7 @@ public static class IArchiveExtensions // Update progress bytesRead += entry.Size; - progress?.Report( - new ProgressReport( - entry.Key ?? string.Empty, - bytesRead, - totalBytes - ) - ); + progress?.Report(new ProgressReport(entry.Key ?? string.Empty, bytesRead, totalBytes)); } } @@ -149,13 +143,7 @@ public static class IArchiveExtensions // Update progress bytesRead += entry.Size; - progress?.Report( - new ProgressReport( - entry.Key ?? string.Empty, - bytesRead, - totalBytes - ) - ); + progress?.Report(new ProgressReport(entry.Key ?? string.Empty, bytesRead, totalBytes)); } } }