@@ -14,7 +14,10 @@ for your needs.
1414
1515Modify the prompt to prioritize certain issue types:
1616
17- ``` javascript
17+ {{< tabs group="language" >}}
18+ {{< tab name="TypeScript" >}}
19+
20+ ``` typescript
1821const prompt = ` Using SonarQube and GitHub MCP tools:
1922
2023Focus only on:
@@ -25,9 +28,29 @@ Focus only on:
2528Analyze "${repoPath }" and fix the highest priority issues first. ` ;
2629```
2730
31+ {{< /tab >}}
32+ {{< tab name="Python" >}}
33+
34+ ``` python
35+ prompt = f """ Using SonarQube and GitHub MCP tools:
36+
37+ Focus only on:
38+ - Security vulnerabilities (CRITICAL priority)
39+ - Bugs (HIGH priority)
40+ - Skip code smells for this iteration
41+
42+ Analyze " { repo_path} " and fix the highest priority issues first. """
43+ ```
44+
45+ {{< /tab >}}
46+ {{< /tabs >}}
47+
2848## Integrate with CI/CD
2949
30- Add this workflow to GitHub actions to run automatically on pull requests:
50+ Add this workflow to GitHub Actions to run automatically on pull requests:
51+
52+ {{< tabs group="language" >}}
53+ {{< tab name="TypeScript" >}}
3154
3255``` yaml
3356name : Automated quality checks
4265 - uses : actions/checkout@v4
4366 - uses : actions/setup-node@v4
4467 with :
45- node-version : ' 18 '
68+ node-version : " 18 "
4669 - run : npm install
47- - run : node 06-quality-gated-pr.js
70+ - run : npx tsx 06-quality-gated-pr.ts
4871 env :
4972 E2B_API_KEY : ${{ secrets.E2B_API_KEY }}
5073 ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
@@ -55,11 +78,46 @@ jobs:
5578 SONARQUBE_ORG : your-org-key
5679` ` `
5780
81+ {{< /tab >}}
82+ {{< tab name="Python" >}}
83+
84+ ` ` ` yaml
85+ name : Automated quality checks
86+ on :
87+ pull_request :
88+ types : [opened, synchronize]
89+
90+ jobs :
91+ quality :
92+ runs-on : ubuntu-latest
93+ steps :
94+ - uses : actions/checkout@v4
95+ - uses : actions/setup-python@v5
96+ with :
97+ python-version : " 3.8"
98+ - run : pip install e2b python-dotenv
99+ - run : python 06_quality_gated_pr.py
100+ env :
101+ E2B_API_KEY : ${{ secrets.E2B_API_KEY }}
102+ ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
103+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104+ SONARQUBE_TOKEN : ${{ secrets.SONARQUBE_TOKEN }}
105+ GITHUB_OWNER : ${{ github.repository_owner }}
106+ GITHUB_REPO : ${{ github.event.repository.name }}
107+ SONARQUBE_ORG : your-org-key
108+ ` ` `
109+
110+ {{< /tab >}}
111+ {{< /tabs >}}
112+
58113## Filter by file patterns
59114
60115Target specific parts of your codebase:
61116
62- ` ` ` javascript
117+ {{< tabs group="language" >}}
118+ {{< tab name="TypeScript" >}}
119+
120+ ` ` ` typescript
63121const prompt = `Analyze code quality but only consider :
64122- Files in src/**/*.js
65123- Exclude test files (*.test.js, *.spec.js)
@@ -68,21 +126,56 @@ const prompt = `Analyze code quality but only consider:
68126Focus on production code only.`;
69127```
70128
129+ {{< /tab >}}
130+ {{< tab name="Python" >}}
131+
132+ ``` python
133+ prompt = """ Analyze code quality but only consider:
134+ - Files in src/**/*.js
135+ - Exclude test files (*.test.js, *.spec.js)
136+ - Exclude build artifacts in dist/
137+
138+ Focus on production code only."""
139+ ```
140+
141+ {{< /tab >}}
142+ {{< /tabs >}}
143+
71144## Set quality thresholds
72145
73146Define when PRs should be created:
74147
75- ``` javascript
148+ {{< tabs group="language" >}}
149+ {{< tab name="TypeScript" >}}
150+
151+ ``` typescript
76152const prompt = ` Quality gate thresholds:
77153- Only create PR if:
78154 * Bug count decreases by at least 1
79155 * No new security vulnerabilities introduced
80- * Code coverage doesn't decrease
156+ * Code coverage does not decrease
81157 * Technical debt reduces by at least 15 minutes
82158
83- If changes don't meet these thresholds, explain why and skip PR creation.` ;
159+ If changes do not meet these thresholds, explain why and skip PR creation. ` ;
84160```
85161
162+ {{< /tab >}}
163+ {{< tab name="Python" >}}
164+
165+ ``` python
166+ prompt = """ Quality gate thresholds:
167+ - Only create PR if:
168+ * Bug count decreases by at least 1
169+ * No new security vulnerabilities introduced
170+ * Code coverage does not decrease
171+ * Technical debt reduces by at least 15 minutes
172+
173+ If changes do not meet these thresholds, explain why and skip PR creation."""
174+ ```
175+
176+ {{< /tab >}}
177+ {{< /tabs >}}
178+
86179## Next steps
87180
88181Learn how to troubleshoot common issues.
0 commit comments