Skip to content

Apply NuGetCacheTool PR#8 improvements to TemplateDotNetTool#48

Merged
Malcolmnixon merged 6 commits intomainfrom
copilot/review-pull-request-template
Mar 1, 2026
Merged

Apply NuGetCacheTool PR#8 improvements to TemplateDotNetTool#48
Malcolmnixon merged 6 commits intomainfrom
copilot/review-pull-request-template

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

Backports improvements identified and applied in NuGetCacheTool PR#8 to this template repository so downstream tools benefit from them on next sync.

Description

Correctness — stderr vs stdout

  • Context.WriteError() now writes to Console.Error instead of Console.Out
  • Program.Main catch blocks now write to Console.Error instead of Console.Out

Reliability — log file flushing

  • Context.OpenLogFile opens StreamWriter with AutoFlush = true

Test coverage

  • Context_WriteError_SetsErrorExitCode — verifies exit code 1 after error
  • Context_WriteError_NotSilent_WritesToConsole — verifies stderr output
  • Context_WriteError_Silent_DoesNotWriteToConsole — verifies silent suppression of stderr
  • Context_WriteError_WritesToLogFile — verifies error persistence to log file
  • Context_WriteLine_Silent_DoesNotWriteToConsole — verifies silent suppression of stdout (required by TMPL-CMD-004)
  • Context_Create_LogFlag_WithoutValue_ThrowsArgumentException — missing --log value
  • Context_Create_ResultsFlag_WithoutValue_ThrowsArgumentException — missing --results value
  • IntegrationTest_ValidateWithResults_GeneratesJUnitFile — JUnit output path

Requirements traceability (requirements.yaml)

  • Linked Program_Version_ReturnsNonEmptyString → TMPL-CMD-002
  • Linked IntegrationTest_ValidateWithResults_GeneratesJUnitFile → TMPL-CMD-006
  • TMPL-CMD-008 — write error messages to stderr (split from compound requirement)
  • TMPL-CMD-009 — rejection of unknown/malformed arguments
  • TMPL-CMD-010 — return a non-zero exit code on failure (split from compound requirement)
  • Renamed all Command-Line Interface requirements from TMPL-REQ-xxx to TMPL-CMD-xxx (001–010)
  • Renamed all Platform Support requirements from TMPL-REQ-xxx to TMPL-PLT-xxx (001–005)

Documentation

  • guide.md: notes errors go to stderr; clarifies --results accepts TRX or JUnit format

Consistency

  • Test project LangVersion: 12latest
  • AGENTS.md Tech Stack: C# 12C# (latest)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully: dotnet build --configuration Release
  • All unit tests pass: dotnet test --configuration Release
  • Self-validation tests pass:
    dotnet run --project src/DemaConsulting.TemplateDotNetTool --configuration Release --framework net10.0
    --no-build -- --validate
  • Code produces zero warnings

Code Quality

  • Code formatting is correct: dotnet format --verify-no-changes
  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

Please run the following checks before submitting:

  • Spell checker passes: cspell "**/*.{md,cs}"
  • Markdown linter passes: markdownlint "**/*.md"
  • YAML linter passes: yamllint .

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable)
  • Updated ARCHITECTURE.md (if applicable)
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable)

Additional Notes

All 39 tests pass across .NET 8, 9, and 10. CodeQL found no alerts.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Review improvements for pull request template Apply NuGetCacheTool PR#8 improvements to TemplateDotNetTool Mar 1, 2026
…rements

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
@Malcolmnixon
Copy link
Contributor

@copilot TMPL-REQ-004 wasn't satisfied in the CI build pipeline

…TMPL-REQ-004

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot TMPL-REQ-004 wasn't satisfied in the CI build pipeline

The Context_WriteLine_Silent_DoesNotWriteToConsole test was accidentally removed during the PR changes. Restored in f14a112 — all 39 tests now pass.

| `--silent` | Suppress console output |
| `--validate` | Run self-validation |
| `--results <file>` | Write validation results to file (TRX or JUnit format) |
| `--results <file>` | Write validation results to file (.trx or .xml) |
Copy link
Contributor

Choose a reason for hiding this comment

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

.trx makes sense, but .xml could be anything, I think people will understand TRX or JUnit better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in fa79789 — changed to "TRX or JUnit format".

- Context_WriteError_NotSilent_WritesToConsole
- IntegrationTest_UnknownArgument_ReturnsError

- id: TMPL-REQ-015
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps fix the order of the 15/14 requirements seeing as they're both new.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in fa79789 — order is now TMPL-CMD-013, TMPL-CMD-014, TMPL-CMD-015.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's have all "Command-Line Interface" requirements be TMPL-CMD-xxx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in fa79789 — all Command-Line Interface requirements renamed to TMPL-CMD-001 through TMPL-CMD-015.


- title: Platform Support
requirements:
- id: TMPL-REQ-008
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's have all Platform Support requirements be TMPL-PLT-xxx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in fa79789 — all Platform Support requirements renamed to TMPL-PLT-008 through TMPL-PLT-012.

…LT-xxx; fix REQ order and guide wording

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
- Context_Create_LogFlag_OpensLogFile
- IntegrationTest_LogFlag_WritesOutputToFile

- id: TMPL-CMD-013
Copy link
Contributor

Choose a reason for hiding this comment

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

Please.renumber these requirements 008-010

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renumbered in 37e5923 — TMPL-CMD-013/014/015 are now TMPL-CMD-008/009/010.

- title: Platform Support
requirements:
- id: TMPL-REQ-008
- id: TMPL-PLT-008
Copy link
Contributor

Choose a reason for hiding this comment

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

The PLT requirements can start from 001. Please renumber

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renumbered in 37e5923 — TMPL-PLT now starts from 001 (TMPL-PLT-001 through TMPL-PLT-005).

…08-012 to 001-005

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot TMPL-REQ-004 wasn't satisfied in the CI build pipeline

The Context_WriteLine_Silent_DoesNotWriteToConsole test (required to satisfy TMPL-CMD-004) was restored in f14a112. The requirement ID was subsequently renamed from TMPL-REQ-004 to TMPL-CMD-004 in fa79789.

@Malcolmnixon Malcolmnixon marked this pull request as ready for review March 1, 2026 19:20
@Malcolmnixon Malcolmnixon merged commit 5b0ddac into main Mar 1, 2026
11 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/review-pull-request-template branch March 1, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants