Skip to content

Add issues to report with branch filtering#24

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/add-issues-to-report
Closed

Add issues to report with branch filtering#24
Copilot wants to merge 4 commits intomainfrom
copilot/add-issues-to-report

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 20, 2026

  • Add --branch command-line argument to Context class
  • Update Context to use GITHUB_REF environment variable if --branch is not specified
  • Update CeTaskResult to include submittedAt, startedAt, and executedAt timestamps
  • Create SonarIssue record to represent individual issues
  • Update SonarQualityResult to include list of issues
  • Add GetIssuesAsync method to SonarQubeClient to fetch issues from API
  • Update ToMarkdown in SonarQualityResult to include Issues section
  • Add help text for --branch argument in Program.cs
  • Add tests for new functionality
  • Build and test the changes
  • Code review completed and feedback addressed
  • Security scan completed (zero vulnerabilities)
  • Refactored ServerUrl trimming to happen once during parsing

Summary

Successfully implemented feature to add SonarQube issues to the markdown report:

  • Added --branch command-line option (falls back to GITHUB_REF environment variable)
  • CeTaskResult captures timestamps (submittedAt, startedAt, executedAt)
  • New SonarIssue record stores severity, type, and component path
  • Issues fetched via /api/issues/search API with proper URL encoding
  • Issues displayed in new table section in markdown report
  • ServerUrl trailing slashes trimmed once during parsing (cleaner code)
  • All 75 tests pass with zero warnings
  • Zero security vulnerabilities detected
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Add Issues to report</issue_title>
<issue_description>### Problem Statement

The SonarQualityResult record and Markdown output should contain a list of the issues associated with the scan.

Proposed Solution

Unfortunately SonarQube does not have an API to perform this directly, instead the best option is to use the following REST API "[ServerURL]/api/issues/search?componentKeys=[ProjectKey]&ps=500&issueStatuses=OPEN,CONFIRMED&branch=[branch]&updatedAfter=[DateTime]"

Omitting the branch and updatedAfter may result in including issues associated with other branches or analysis.

To support specifying the branch, a new --branch command-line argument should be introduced; however if unspecified then the github GITHUB_REF environment variable may be used (remembering to strip the "refs/heads/" from the front).

To get the updatedAfter time, it may be appropriate to save more information from the /api/ce/task query - specifically the submittedAt, startedAt, and executedAt timestamps.

The interesting fields from the issues are:

  • "severity"
  • "type"
  • "component" with the component skipping the project key so it's just the file path.

These should be put into a table in a new section of the markdown.

Alternatives Considered

No response

Additional Context

No response

Priority

Medium - Would improve workflow

Contribution

  • I would be willing to submit a PR for this feature

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 20, 2026 16:39
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Add issues reporting to SonarQualityResult Add issues to report with branch filtering Jan 20, 2026
Copilot AI requested a review from Malcolmnixon January 20, 2026 16:46
CancellationToken cancellationToken)
{
// Build the URL with query parameters
var url = $"{reportTask.ServerUrl.TrimEnd('/')}/api/issues/search?componentKeys={reportTask.ProjectKey}&ps=500&issueStatuses=OPEN,CONFIRMED&updatedAfter={updatedAfter}";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than doing the TrimEnd everywhere it's used - hows about trimming it when reading the ReportTask information, or even creating a ServerUrlTrimmed property to hide the trimming implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the trimming to ReportTaskParser.Parse() where the ServerUrl is read. This removes the need for TrimEnd calls throughout SonarQubeClient. Fixed in 23cb814.

…where

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI requested a review from Malcolmnixon January 20, 2026 16:55
Copilot AI added a commit that referenced this pull request Mar 27, 2026
…g template PRs

- PR #65: Rename docs folders to standard names:
  - docs/buildnotes/ -> docs/build_notes/
  - docs/quality/ -> docs/code_quality/
  - docs/requirements/ + docs/justifications/ -> docs/requirements_doc/
  - docs/tracematrix/ -> docs/requirements_report/
- PR #65: Update build.yaml paths for all renamed folders
- PR #65: Update .gitignore with new folder paths
- PR #65: Update .cspell.yaml words (build_notes, code_quality, etc.)
- PR #65: Update .reviewmark.yaml (add bin exclusion, update comment)
- PR #24: Update CONTRIBUTING.md and PR template with unit test/self-validation terminology
- PR #27/#65: Update PR template linting section to use lint.sh

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/6186d6a3-a30a-42f2-a075-5c1d62feb92c

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Malcolmnixon added a commit that referenced this pull request Mar 27, 2026
… TemplateDotNetTool (#105)

* Initial plan

* feat: update repo-consistency agent with latest simplified version from TemplateDotNetTool

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/8afcbf80-130d-4fbd-b4ed-bbf6829f1265

* feat: apply template improvements from TemplateDotNetTool PRs #58-#75

- Rename all agent files to *.agent.md naming convention with proper
  YAML frontmatter (tools field, user-invocable, kebab-case names)
- Add code-review.agent.md (PR #59)
- Update AGENTS.md: add Code Review Agent, use @agent call syntax
- Update CONTRIBUTING.md: agent glob to *.agent.md, lint script
- Migrate .cspell.json → .cspell.yaml with policy header (PR #63)
- Migrate .markdownlint-cli2.jsonc → .markdownlint-cli2.yaml (PR #64)
- Update .yamllint.yaml with standards header, .venv/ ignore (PR #64)
- Rewrite lint.sh/lint.bat to self-install npm/pip dependencies (PR #61)
- Update package.json with cspell and markdownlint-cli2 (PR #61)
- Add pip-requirements.txt pinning yamllint==1.38.0 (PR #61)
- Update .gitignore to add .venv/ (PR #61)
- Add .gitattributes for LF line endings (PR #71)
- Update build.yaml: replace 3 lint actions with Node.js+Python+lint.sh (PR #61)
- Update release.yaml: remove 'Move buildnotes' step (PR #75)"

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/faf526d1-b8d3-4731-a959-9925242e1f94

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

* feat: add ReviewMark integration (PR #58 from TemplateDotNetTool)

- Add .reviewmark.yaml with SonarMark-specific review sets
- Add demaconsulting.reviewmark 0.2.0 to .config/dotnet-tools.json
- Update .versionmark.yaml: add reviewmark entry, pre-release regex on all tools
- Update .gitignore: exclude generated review plan/report docs
- Create docs/code_review_plan/ (definition.yaml, title.txt, introduction.md)
- Create docs/code_review_report/ (definition.yaml, title.txt, introduction.md)
- Update build.yaml: add reviewmark to versionmark capture, self-validation,
  review plan/report generation, HTML/PDF generation, and upload"

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/34424117-a082-453c-accd-84cd9b08f24e

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

* Apply TemplateDotNetTool PRs #39, #47, #50 consistency updates

- PR #39: Add CLA sentence to README.md License section
- PR #47: Update Code Analysis ItemGroup comments in main csproj to use
  inline child-element comment style; add inline comments for
  coverlet.collector and Code Analysis packages in test csproj
- PR #50: Fix Assert.HasCount parameter order in CONTRIBUTING.md
  (expectedCount before collection); fix UTF-8 encoding description
  in CONTRIBUTING.md and AGENTS.md (remove BOM reference)

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

* feat: apply TemplateDotNetTool PR #65 folder restructure and remaining template PRs

- PR #65: Rename docs folders to standard names:
  - docs/buildnotes/ -> docs/build_notes/
  - docs/quality/ -> docs/code_quality/
  - docs/requirements/ + docs/justifications/ -> docs/requirements_doc/
  - docs/tracematrix/ -> docs/requirements_report/
- PR #65: Update build.yaml paths for all renamed folders
- PR #65: Update .gitignore with new folder paths
- PR #65: Update .cspell.yaml words (build_notes, code_quality, etc.)
- PR #65: Update .reviewmark.yaml (add bin exclusion, update comment)
- PR #24: Update CONTRIBUTING.md and PR template with unit test/self-validation terminology
- PR #27/#65: Update PR template linting section to use lint.sh

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/6186d6a3-a30a-42f2-a075-5c1d62feb92c

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

* feat: update release.yaml to reference build_notes.md (PR #65)

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/6186d6a3-a30a-42f2-a075-5c1d62feb92c

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

* Update .github/workflows/build.yaml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: add shell: bash to all Pandoc HTML generation steps in build.yaml

All Pandoc steps using $(date +'%Y-%m-%d') bash command substitution now
explicitly specify shell: bash so they work correctly on windows-latest runners.

Agent-Logs-Url: https://github.com/demaconsulting/SonarMark/sessions/58acfc2e-a04e-43d2-a61e-038edb985428

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolm Nixon <Malcolm.nixon@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Malcolmnixon Malcolmnixon deleted the copilot/add-issues-to-report branch March 30, 2026 03:18
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.

[Feature]: Add Issues to report

2 participants