Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .devcontainer/Dockerfile

This file was deleted.

19 changes: 15 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,29 @@
},
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
}
},

"customizations": {
"vscode": {
"settings": {},
"extensions": [
"redhat.vscode-xml",
"visualstudioexptteam.vscodeintellicode",
"vscjava.vscode-java-pack"
"vscjava.vscode-java-pack",
"sonarsource.sonarlint-vscode"
]
}
},
"remoteUser": "vscode"
"remoteUser": "vscode",
"forwardPorts": [8080],
"portsAttributes": {
"8080": {
"label": "Port 8080",
"onAutoForward": "openPreview",
"elevateIfNeeded": true
}
}
}
17 changes: 17 additions & 0 deletions .gitpod/automations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
tasks:
run:
command: |
./mvnw spring-boot:run
dependsOn:
- init
name: "Run PetClinic App"
triggeredBy:
- postDevcontainerStart
- manual
init:
command: |
./mvnw clean install -U -DskipTests
name: "Build"
triggeredBy:
- manual
- prebuild
3 changes: 3 additions & 0 deletions .ona/deploy-to-SE-demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

ona ai automation update 019c95af-e354-7d00-a5ed-5856f50e5957 fix-sonar-issue.yaml
74 changes: 74 additions & 0 deletions .ona/fix-sonar-issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: fix-sonar-issue
description: >-
Picks the highest-severity open SonarQube issue, applies a fix,
verifies tests pass, and opens a pull request.
triggers:
- context:
projects: {}
manual: {}
action:
limits:
maxParallel: 1
maxTotal: 10
steps:
- agent:
prompt: |
You have access to SonarQube tools via MCP. Use them to query the project
"ona-samples_sonarcube-integration" for open issues with BLOCKER or HIGH severity.

Pick the single highest-severity issue (BLOCKER > HIGH). If there are ties,
pick the one in production code (src/main) over test code (src/test).

For the selected issue:
1. Read the SonarQube rule details to understand what the rule requires.
2. Read the affected source file and surrounding context.
3. Note the rule key, severity, file path, line number, and the rule's message.

Do NOT make any code changes yet.
- agent:
prompt: |
Using the issue identified in the previous step:

1. Create a new git branch named "sonar-fix/<rule-key>" (e.g. sonar-fix/java-S2699).
2. Apply the minimal fix that resolves the SonarQube issue while preserving
existing behavior. Follow the project's code style and conventions.

Do NOT commit or run tests yet.
- agent:
prompt: |
Verify the fix from the previous step:

1. Run `./mvnw compile test` to compile and run all tests.
2. If compilation or tests fail:
a. Read the error output carefully.
b. Identify whether the failure is caused by the fix or a pre-existing issue.
c. If caused by the fix, adjust the code and amend the commit.
d. Rerun `./mvnw compile test`.
e. Repeat until all tests pass.
3. Once tests pass, confirm the fix is complete.
- agent:
prompt: |
Commit the fix with message: "Fix SonarQube <rule-key>: <short description>"
Add co-author: "Co-authored-by: Ona <no-reply@ona.com>"
- pullRequest:
branch: sonar-fix/<issue>
title: 'Sonar-Fix: <title>'
description: |
## SonarQube Issue

| Field | Value |
|-------|-------|
| **Issue** | [View in SonarQube Cloud](https://sonarcloud.io/project/issues?id=ona-samples_sonarcube-integration&issues=<issue-key>&open=<issue-key>) |
| **Rule** | `<rule-key>` — [View rule](https://sonarcloud.io/organizations/ona-samples/rules?open=<rule-key>&rule_key=<rule-key>) |
| **Severity** | <severity> |
| **Type** | <clean-code-attribute-category> |
| **Message** | <sonar-message> |

## What changed

<one-or-two-sentence explanation of the fix and why it resolves the issue>

## Verification

- [x] `./mvnw compile test` passes
- [x] Fix is minimal and preserves existing behavior
21 changes: 21 additions & 0 deletions .ona/mcp-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"mcpServers": {
"sonarqube": {
"name": "sonarqube",
"command": "docker",
"args": [
"run", "-i", "--init",
"--name", "sonarqube-mcp-server",
"--rm",
"-e", "SONARQUBE_TOKEN",
"-e", "SONARQUBE_ORG",
"mcp/sonarqube"
],
"env": {
"SONARQUBE_TOKEN": "${exec:printenv SONARQUBE_TOKEN}",
"SONARQUBE_ORG": "${exec:printenv SONARQUBE_ORG}"
},
"timeout": 30
}
}
}
5 changes: 5 additions & 0 deletions .sonarlint/connectedMode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sonarCloudOrganization": "ona-samples",
"projectKey": "ona-samples_sonarqube-cloud",
"region": "EU"
}
Loading