diff --git a/.gitignore b/.gitignore index b6a26aa..15e4073 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,16 @@ bin/ obj/ TestResults/ + +# Code coverage reports +coverage/ +*.coverage +*.coveragexml +*.opencover.xml + +# Test results +*.trx + +# Temporary files +*.tmp +.DS_Store diff --git a/AGENTS.md b/AGENTS.md index a07e829..8cd8575 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -100,8 +100,11 @@ cspell "**/*.{md,cs}" # Run markdown linter (requires npm install -g markdownlint-cli) markdownlint "**/*.md" -# Format code (if format tools are installed) +# Format code dotnet format + +# Verify formatting +dotnet format --verify-no-changes ``` ## Testing Guidelines @@ -226,6 +229,7 @@ All builds must pass: 5. Update XML documentation 6. Update README.md with usage examples 7. Run all tests and ensure they pass +8. Complete pre-finalization quality checks (see below) ### Fixing a Bug @@ -234,6 +238,7 @@ All builds must pass: 3. Ensure the test now passes 4. Verify no other tests are broken 5. Update documentation if the bug fix changes behavior +6. Complete pre-finalization quality checks (see below) ### Improving Code Quality @@ -243,6 +248,7 @@ All builds must pass: 4. Improve naming and clarity 5. Add missing documentation 6. Verify all tests still pass +7. Complete pre-finalization quality checks (see below) ### Updating Dependencies @@ -250,6 +256,55 @@ All builds must pass: 2. Update to latest stable versions when appropriate 3. Test thoroughly after updates 4. Update documentation if APIs changed +5. Complete pre-finalization quality checks (see below) + +## Pre-Finalization Quality Checks + +Before marking any task as complete and finalizing your session, you **MUST** run the following quality checks in this order: + +### 1. Build and Test Validation + +```bash +# Build the project +dotnet build --configuration Release + +# Run all tests +dotnet test --configuration Release +``` + +All builds must complete with zero warnings and all tests must pass. + +### 2. Code Review + +Use the **code_review** tool to get automated feedback on your changes: + +- Review all comments and suggestions +- Address relevant feedback +- If significant changes are made, run code_review again + +### 3. Security Scanning + +Use the **codeql_checker** tool to scan for security vulnerabilities: + +- This tool must be run after code_review is complete +- Investigate all alerts discovered +- Fix any alerts that require localized changes +- Re-run codeql_checker after fixes to verify +- Include a Security Summary with any unfixed vulnerabilities + +### Quality Check Workflow + +The complete workflow before task completion: + +1. Make code changes +2. Run build and tests → Fix any issues +3. Run code_review tool → Address relevant feedback +4. Run codeql_checker tool → Fix security issues +5. If significant changes were made, repeat steps 2-4 +6. Report progress with final commit +7. Complete task + +**Note**: Only proceed to finalize your task after all quality checks pass and all issues are addressed. ## Boundaries and Guardrails @@ -270,6 +325,7 @@ All builds must pass: - Add tests for new functionality - Resolve all warnings and analyzer suggestions - Keep changes minimal and focused +- Complete all pre-finalization quality checks (build, test, code_review, codeql_checker) before marking work as complete ### What AI Agents Should ASK About diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 104eccc..2090b31 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -61,11 +61,13 @@ An enumeration representing possible test outcomes: #### `TrxSerializer` -The `TrxSerializer` class is responsible for converting the domain model into TRX XML format: +The `TrxSerializer` class is responsible for converting between the domain model and TRX XML format: - Uses .NET's built-in XML serialization capabilities - Produces TRX files compatible with Visual Studio and Azure DevOps +- Can deserialize TRX XML files back into the domain model - Handles proper formatting and schema compliance +- Implements helper methods for complex XML structure creation to maintain code clarity and reduce complexity #### `JUnitSerializer` @@ -76,6 +78,7 @@ The `JUnitSerializer` class is responsible for converting between the domain mod - Can deserialize JUnit XML files back into the domain model - Groups test results by class name into test suites - Maps test outcomes to JUnit semantics (failure, error, skipped) +- Implements helper methods for complex XML structure creation to maintain code clarity and reduce complexity ## Data Flow @@ -89,8 +92,13 @@ The `JUnitSerializer` class is responsible for converting between the domain mod ## Design Patterns - **Data Transfer Object (DTO)**: The `TestResults` and `TestResult` classes serve as DTOs for test data -- **Serializer Pattern**: The `TrxSerializer` class encapsulates all serialization logic +- **Serializer Pattern**: The `TrxSerializer` and `JUnitSerializer` classes encapsulate all + serialization/deserialization logic - **Builder Pattern**: The API allows for fluent construction of test results +- **Helper Method Extraction**: Complex serialization/deserialization logic is broken down into focused helper + methods, each handling a specific portion of the XML structure +- **Constant Extraction**: Repeated string literals are extracted as private constants to improve maintainability + and reduce duplication ## File Organization @@ -138,10 +146,10 @@ The library is designed to be extended in several ways: Potential enhancements that could be considered: -1. **Deserialization**: Add support for reading existing TRX and JUnit XML files back into the object model -2. **Additional Formats**: Support for other test result formats (NUnit XML, xUnit XML, etc.) -3. **Streaming**: Support for streaming large test result sets to avoid memory issues -4. **Validation**: Add schema validation to ensure generated files are well-formed +1. **Additional Formats**: Support for other test result formats (NUnit XML, xUnit XML, etc.) +2. **Streaming**: Support for streaming large test result sets to avoid memory issues +3. **Validation**: Add schema validation to ensure generated files are well-formed +4. **Format Detection**: Automatic detection of input format when deserializing ## Dependencies diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6af004..9f67923 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,8 +95,32 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme 2. Make your changes, following the coding guidelines below 3. Add or update tests as needed 4. Run the full test suite to ensure nothing is broken -5. Commit your changes with a clear and descriptive commit message -6. Push to your fork and submit a pull request +5. Run pre-commit quality checks (see below) +6. Commit your changes with a clear and descriptive commit message +7. Push to your fork and submit a pull request + +### Pre-Commit Quality Checks + +Before committing your changes, ensure the following checks pass: + +```bash +# Build the project +dotnet build --configuration Release + +# Run all tests +dotnet test --configuration Release + +# Verify code formatting +dotnet format --verify-no-changes + +# (Optional) Run spell checker if you modified documentation +cspell "**/*.{md,cs}" + +# (Optional) Run markdown linter if you modified markdown files +markdownlint "**/*.md" +``` + +All builds must complete with zero warnings, and all tests must pass. ## Coding Guidelines