Skip to content

Reorganize SonarMark into subsystem folder structure (mirrors TemplateDotNetTool PR #81)#111

Merged
Malcolmnixon merged 5 commits intomainfrom
copilot/update-folder-structure-and-docs
Mar 31, 2026
Merged

Reorganize SonarMark into subsystem folder structure (mirrors TemplateDotNetTool PR #81)#111
Malcolmnixon merged 5 commits intomainfrom
copilot/update-folder-structure-and-docs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

Applies the subsystem folder structure from TemplateDotNetTool#81 to SonarMark, organizing all source, test, design, and requirements files under explicit subsystem boundaries.

Description

Mirrors the four-subsystem breakdown already described in docs/design/introduction.md into the physical folder layout across all artifact types.

Source & Test (src/, test/)

Six classes moved into subsystem subfolders with updated file-scoped namespaces:

Class From To Namespace suffix
Context root Cli/ .Cli
SonarQubeClient, SonarHotSpot, SonarIssue root SonarIntegration/ .SonarIntegration
SonarQualityResult root ReportGeneration/ .ReportGeneration
Validation root SelfTest/ .SelfTest

Program.cs remains at root; using directives added for the new namespaces. Context.cs also gains using DemaConsulting.SonarMark.SonarIntegration; so that SonarQubeClient can be referenced without qualification. Test project mirrors the same layout.

Design Docs (docs/design/)

  • Unit docs moved into matching subsystem subfolders (cli/, sonar-integration/, report-generation/, self-test/)
  • Four new subsystem design docs added (Overview / Units / Interfaces / Interactions)
  • introduction.md updated with Software Structure (system/subsystem/unit tree) and Folder Layout sections
  • definition.yaml updated with new resource-path entries and input files ordered subsystem-before-unit

Requirements (docs/reqstream/)

  • Six unit reqstream files moved into subsystem subfolders
  • Four new subsystem requirements files added (subsystem-cli.yaml, subsystem-sonar-integration.yaml, subsystem-report-generation.yaml, subsystem-self-test.yaml)
  • requirements.yaml updated to reference all new and moved files
  • children links added to requirements to establish the downward hierarchy:
    • System requirements → relevant subsystem requirement IDs
    • Subsystem requirements → all unit requirement IDs within that subsystem
  • Test name references corrected in subsystem-cli.yaml (3 names aligned to actual test method names)

Reviews (.reviewmark.yaml)

  • All review-set paths updated to new locations
  • SonarMark-Requirements renamed to SonarMark-AllRequirements (matches template pattern)
  • SonarMark-AllRequirements paths use docs/reqstream/**/*.yaml glob pattern instead of explicit file list
  • SonarMark-Design updated to glob docs/design/**/*.md
  • New SonarMark-SelfTest subsystem review added

New Tests (SonarIntegration/)

  • SonarQubeClient.CreateHttpClient made internal static (accessible via existing InternalsVisibleTo)
  • SonarQubeClient_Constructor_WithToken_SetsAuthorizationHeader — verifies that a token causes the Authorization: Basic header to be set on the underlying HttpClient
  • SonarQubeClient_Constructor_WithoutToken_NoAuthorizationHeader — verifies that omitting a token leaves the Authorization header absent

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

Pre-Submission Checklist

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.SonarMark --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

Linting

  • All linters pass: ./lint.sh (Unix/macOS) or cmd /c lint.bat / ./lint.bat (Windows)

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

No logic changes — pure structural reorganization plus two new targeted unit tests for SonarQubeClient authentication header behaviour. All 86 tests pass across net8.0, net9.0, and net10.0 (258 total). All linters pass: markdownlint, yamllint, cspell, dotnet format, and dotnet reqstream --lint.

- Move source files into Cli/, SelfTest/, SonarIntegration/, ReportGeneration/
- Update namespaces and using statements in all moved files
- Mirror the same layout in test project
- Move design docs and reqstream files into subsystem subdirectories
- Add subsystem overview design docs and requirements files
- Update docs/design/definition.yaml, requirements.yaml, .reviewmark.yaml

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Update folder structures and documentation for software organization Reorganize SonarMark into subsystem folder structure (mirrors TemplateDotNetTool PR #81) Mar 31, 2026
Copilot AI requested a review from Malcolmnixon March 31, 2026 18:38
…ob in reviewmark AllRequirements

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/a74327f2-5782-4fb9-8a8f-b304849242d7

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
@Malcolmnixon Malcolmnixon marked this pull request as ready for review March 31, 2026 19:16
Copilot AI review requested due to automatic review settings March 31, 2026 19:16
@Malcolmnixon
Copy link
Copy Markdown
Member

@copilot Please review all requirements and their linking, and make sure:

children links go "down" in the software structure
children links go to relevant child requirement IDs.

@Malcolmnixon
Copy link
Copy Markdown
Member

@copilot There are numerous linting issues reported - please fix.

Copy link
Copy Markdown
Contributor

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

Reorganizes SonarMark’s code, tests, design docs, and requirements into an explicit subsystem-based folder structure (CLI, SonarIntegration, ReportGeneration, SelfTest) to align physical layout with the design’s subsystem breakdown.

Changes:

  • Moved core source/test classes into subsystem folders and updated C# file-scoped namespaces + using directives accordingly.
  • Reorganized and expanded design documentation and reqstream requirements into matching subsystem subfolders, updating manifests and review sets.
  • Updated .reviewmark.yaml and requirements.yaml to point at the new paths (with more use of globs for coverage).

Reviewed changes

Copilot reviewed 26 out of 38 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/DemaConsulting.SonarMark.Tests/SonarIntegration/SonarQubeClientTests.cs Updated test namespace/imports to match SonarIntegration subsystem layout.
test/DemaConsulting.SonarMark.Tests/SonarIntegration/SonarIssueTests.cs Updated test namespace/imports to match SonarIntegration subsystem layout.
test/DemaConsulting.SonarMark.Tests/SonarIntegration/SonarHotSpotTests.cs Updated test namespace/imports to match SonarIntegration subsystem layout.
test/DemaConsulting.SonarMark.Tests/SelfTest/ValidationTests.cs Updated test namespace/imports to match SelfTest subsystem layout.
test/DemaConsulting.SonarMark.Tests/ReportGeneration/SonarQualityResultTests.cs Updated test namespace/imports to match ReportGeneration subsystem layout.
test/DemaConsulting.SonarMark.Tests/ProgramTests.cs Added imports for moved namespaces used by Program tests.
test/DemaConsulting.SonarMark.Tests/Cli/ContextTests.cs Updated test namespace/imports to match CLI subsystem layout.
src/DemaConsulting.SonarMark/SonarIntegration/SonarQubeClient.cs Moved into SonarIntegration namespace; updated dependency imports.
src/DemaConsulting.SonarMark/SonarIntegration/SonarIssue.cs Moved into SonarIntegration namespace.
src/DemaConsulting.SonarMark/SonarIntegration/SonarHotSpot.cs Moved into SonarIntegration namespace.
src/DemaConsulting.SonarMark/SelfTest/Validation.cs Moved into SelfTest namespace; updated imports for subsystem dependencies.
src/DemaConsulting.SonarMark/ReportGeneration/SonarQualityResult.cs Moved into ReportGeneration namespace; imports SonarIntegration types.
src/DemaConsulting.SonarMark/Program.cs Added imports for subsystem namespaces referenced by Program.
src/DemaConsulting.SonarMark/Cli/Context.cs Moved into Cli namespace; imports SonarIntegration for factory typing.
requirements.yaml Updated includes list to new subsystem folder structure.
docs/reqstream/sonar-integration/unit-sonar-qube-client.yaml Added/moved unit requirements into sonar-integration folder.
docs/reqstream/sonar-integration/unit-sonar-issue.yaml Added/moved unit requirements into sonar-integration folder.
docs/reqstream/sonar-integration/unit-sonar-hot-spot.yaml Added/moved unit requirements into sonar-integration folder.
docs/reqstream/sonar-integration/subsystem-sonar-integration.yaml Added subsystem-level requirements for SonarIntegration.
docs/reqstream/self-test/unit-validation.yaml Added/moved unit requirements into self-test folder.
docs/reqstream/self-test/subsystem-self-test.yaml Added subsystem-level requirements for SelfTest.
docs/reqstream/report-generation/unit-sonar-quality-result.yaml Added/moved unit requirements into report-generation folder.
docs/reqstream/report-generation/subsystem-report-generation.yaml Added subsystem-level requirements for ReportGeneration.
docs/reqstream/cli/unit-context.yaml Added/moved unit requirements into cli folder.
docs/reqstream/cli/subsystem-cli.yaml Added subsystem-level requirements for CLI.
docs/design/sonar-integration/sonar-qube-client.md Added/moved SonarQubeClient design doc into sonar-integration folder.
docs/design/sonar-integration/sonar-issue.md Added/moved SonarIssue design doc into sonar-integration folder.
docs/design/sonar-integration/sonar-integration.md Added subsystem overview doc for SonarIntegration.
docs/design/sonar-integration/sonar-hot-spot.md Added/moved SonarHotSpot design doc into sonar-integration folder.
docs/design/self-test/validation.md Added/moved Validation design doc into self-test folder.
docs/design/self-test/self-test.md Added subsystem overview doc for SelfTest.
docs/design/report-generation/sonar-quality-result.md Added/moved SonarQualityResult design doc into report-generation folder.
docs/design/report-generation/report-generation.md Added subsystem overview doc for ReportGeneration.
docs/design/introduction.md Updated to include software structure + folder layout sections.
docs/design/definition.yaml Updated pandoc definition to include subsystem directories and inputs.
docs/design/cli/context.md Added/moved Context design doc into cli folder.
docs/design/cli/cli.md Added subsystem overview doc for CLI.
.reviewmark.yaml Updated review-set paths/globs and added subsystem review set(s).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Malcolmnixon
Copy link
Copy Markdown
Member

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot Please review all requirements and their linking, and make sure:

children links go "down" in the software structure
...

Done in 2a7932c. Added children links flowing down the hierarchy:

  • System → Subsystem: each system requirement links to the subsystem(s) that implement it (SonarIntegration + ReportGeneration for data retrieval/reporting requirements; Cli + SonarIntegration + ReportGeneration for the full report requirement)
  • Subsystem → Unit: each subsystem requirement lists all unit requirement IDs from its constituent units (e.g., SonarMark-Subsystem-Cli → 14 unit requirements from Program + Context; SonarMark-Subsystem-SonarIntegration → 9 unit requirements from SonarQubeClient + SonarHotSpot + SonarIssue)

dotnet reqstream --lint passes with no issues.

…header tests

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/aa5c4ed5-8d7f-4d0b-a194-8b3d3982ba50

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

Copilot AI commented Mar 31, 2026

@copilot There are numerous linting issues reported - please fix.

Fixed in dcab99e. Issues resolved:

  • MD060 (table column style): fixed separator rows in cli.md, report-generation.md, self-test.md, and sonar-integration.md
  • MD012 (multiple blank lines): removed extra trailing blank line in introduction.md
  • MD013/YAML line-length: shortened long line in sonar-integration.md and wrapped long title: values in the two subsystem YAML files using >- block scalars

All linters now pass: markdownlint, yamllint, cspell, and dotnet format.

@copilot apply changes based on the comments in this thread

Done in dcab99e — wrong test names corrected and two new tests added. See replies above in each thread for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node install.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 27 out of 39 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

test/DemaConsulting.SonarMark.Tests/SonarIntegration/SonarQubeClientTests.cs:71

  • The “WithToken/WithoutToken” tests are named as constructor tests, but they currently call SonarQubeClient.CreateHttpClient(...) directly and never instantiate SonarQubeClient. This can pass even if the constructor stops using CreateHttpClient (or mutates headers differently), so it doesn’t actually verify the behavior the test name (and requirements traceability) claims. Consider asserting against the HttpClient created by the constructor (e.g., expose the underlying HttpClient via an internal property for tests, or use reflection) so the test truly covers constructor behavior.
    test/DemaConsulting.SonarMark.Tests/SonarIntegration/SonarQubeClientTests.cs:71
  • The authorization-header assertion only checks the scheme is Basic, but not that the token was actually encoded into the header parameter (e.g., Base64 of token:) as implemented in CreateHttpClient. Strengthen the test by also validating the Authorization.Parameter value matches the expected encoded token, so regressions in the header value are caught.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Malcolmnixon Malcolmnixon merged commit 85a57d0 into main Mar 31, 2026
19 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/update-folder-structure-and-docs branch March 31, 2026 20:07
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.

3 participants