Compare commits
2 Commits
dev
...
98f0a0c154
| Author | SHA1 | Date | |
|---|---|---|---|
| 98f0a0c154 | |||
| d5f56d8b0c |
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
|
|
||||||
MCP предоставляет ассистенту доступ к данным SonarQube. Используй инструменты для:
|
|
||||||
Поиска проблем: search_sonar_issues_in_projects
|
|
||||||
Проверки статуса: get_project_quality_gate_status, get_system_status, get_system_health
|
|
||||||
Анализа кода: analyze_code_snippet, get_raw_source
|
|
||||||
Работы с задачами: change_sonar_issue_status
|
|
||||||
Получения метрик: get_component_measures, search_metrics
|
|
||||||
Получение документации по библиотекам: use context7
|
|
||||||
Не гадай — запрашивай данные. Уточняй ключи проектов и issue. Действуй точно, опираясь на информацию из SonarQube.
|
|
||||||
Текущий проект ChatBot
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
---
|
|
||||||
description: SonarQube MCP Server usage guidelines
|
|
||||||
globs:
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
|
|
||||||
These are some guidelines when using the SonarQube MCP server.
|
|
||||||
|
|
||||||
# Important Tool Guidelines
|
|
||||||
|
|
||||||
## Basic usage
|
|
||||||
- When starting a new task, disable automatic analysis with the `toggle_automatic_analysis` tool if it exists.
|
|
||||||
- When you are done generating code at the very end of the task, re-enable automatic analysis with the `toggle_automatic_analysis` tool if it exists.
|
|
||||||
Then call the `analyze_file_list` tool if it exists.
|
|
||||||
|
|
||||||
## Project Keys
|
|
||||||
- When a user mentions a project key, use `search_my_sonarqube_projects` first to find the exact project key
|
|
||||||
- Don't guess project keys - always look them up
|
|
||||||
|
|
||||||
## Code Language Detection
|
|
||||||
- When analyzing code snippets, try to detect the programming language from the code syntax
|
|
||||||
- If unclear, ask the user or make an educated guess based on syntax
|
|
||||||
|
|
||||||
## Branch and Pull Request Context
|
|
||||||
- Many operations support branch-specific analysis
|
|
||||||
- If user mentions working on a feature branch, include the branch parameter
|
|
||||||
- Pull request analysis is available for PR-specific insights
|
|
||||||
|
|
||||||
## Code Issues and Violations
|
|
||||||
- After fixing issues, do not attempt to verify them using `search_sonar_issues_in_projects`, as the server will not yet reflect the updates
|
|
||||||
|
|
||||||
# Common Troubleshooting
|
|
||||||
|
|
||||||
## Authentication Issues
|
|
||||||
- SonarQube requires USER tokens (not project tokens)
|
|
||||||
- When the error `SonarQube answered with Not authorized` occurs, verify the token type
|
|
||||||
|
|
||||||
## Project Not Found
|
|
||||||
- Use `search_my_sonarqube_projects` to confirm available projects
|
|
||||||
- Check if user has access to the specific project
|
|
||||||
- Verify project key spelling and format
|
|
||||||
|
|
||||||
## Code Analysis Issues
|
|
||||||
- Ensure programming language is correctly specified
|
|
||||||
- Remind users that snippet analysis doesn't replace full project scans
|
|
||||||
- Provide full file content for better analysis results
|
|
||||||
- Mention that code snippet analysis tool has limited capabilities compared to full SonarQube scans
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
name: SonarQube
|
name: SonarQube
|
||||||
on:
|
on:
|
||||||
pull_request:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build and analyze
|
name: Build and analyze
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
name: Publish Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
name: Build and Publish to Harbor
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to Harbor
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: harbor.home
|
|
||||||
username: robot$chatbot
|
|
||||||
password: ${{ secrets.HARBOR_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: harbor.home/chatbot/chatbot
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=sha,prefix={{branch}}-
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: ./ChatBot
|
|
||||||
file: ./ChatBot/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=registry,ref=harbor.home/chatbot/chatbot:buildcache
|
|
||||||
cache-to: type=registry,ref=harbor.home/chatbot/chatbot:buildcache,mode=max
|
|
||||||
|
|
||||||
- name: Image digest
|
|
||||||
run: echo "Image published with digest ${{ steps.build.outputs.digest }}"
|
|
||||||
@@ -3,7 +3,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- dev
|
- develop
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
@@ -11,7 +11,6 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: Run Tests
|
name: Run Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class ChatSessionCompressionTests
|
|||||||
.Setup(x => x.CompressHistoryAsync(It.IsAny<List<ChatMessage>>(), It.IsAny<int>(), It.IsAny<CancellationToken>()))
|
.Setup(x => x.CompressHistoryAsync(It.IsAny<List<ChatMessage>>(), It.IsAny<int>(), It.IsAny<CancellationToken>()))
|
||||||
.Returns(async (List<ChatMessage> messages, int target, CancellationToken ct) =>
|
.Returns(async (List<ChatMessage> messages, int target, CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
await Task.Delay(50, ct);
|
await Task.Delay(50);
|
||||||
return delayedResult;
|
return delayedResult;
|
||||||
});
|
});
|
||||||
compressionServiceMock
|
compressionServiceMock
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ public class ChatSessionTests
|
|||||||
var session = new ChatSession();
|
var session = new ChatSession();
|
||||||
session.AddUserMessage("Test", "user");
|
session.AddUserMessage("Test", "user");
|
||||||
var lastUpdated = session.LastUpdatedAt;
|
var lastUpdated = session.LastUpdatedAt;
|
||||||
await Task.Delay(10, CancellationToken.None); // Small delay
|
await Task.Delay(10); // Small delay
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
session.ClearHistory();
|
session.ClearHistory();
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class InMemorySessionStorageTests
|
|||||||
var originalTime = session.LastUpdatedAt;
|
var originalTime = session.LastUpdatedAt;
|
||||||
|
|
||||||
// Wait a bit to ensure time difference
|
// Wait a bit to ensure time difference
|
||||||
await Task.Delay(10, CancellationToken.None);
|
await Task.Delay(10);
|
||||||
|
|
||||||
session.ChatTitle = "Updated Title";
|
session.ChatTitle = "Updated Title";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user