Skip to content

Commit a4f34dd

Browse files
committed
Merge branch 'main' into changelog-update-v0.4.0
2 parents 5be3883 + 6ca08df commit a4f34dd

File tree

6 files changed

+387
-6
lines changed

6 files changed

+387
-6
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: JetBrains Auto-Approval Compliance
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
compliance-check:
11+
runs-on: ubuntu-latest
12+
name: JetBrains Compliance Linting
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK 21
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
24+
- name: Cache Gradle packages
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.gradle/caches
29+
~/.gradle/wrapper
30+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31+
restore-keys: |
32+
${{ runner.os }}-gradle-
33+
34+
- name: Make gradlew executable
35+
run: chmod +x ./gradlew
36+
37+
- name: Run JetBrains Compliance Checks
38+
run: |
39+
echo "Running JetBrains auto-approval compliance checks with detekt..."
40+
./gradlew detekt
41+
42+
- name: Upload detekt reports
43+
uses: actions/upload-artifact@v4
44+
if: always()
45+
with:
46+
name: detekt-reports
47+
path: |
48+
build/reports/detekt/
49+
retention-days: 30
50+
51+
- name: Comment PR with compliance status
52+
if: github.event_name == 'pull_request' && failure()
53+
uses: actions/github-script@v7
54+
with:
55+
script: |
56+
github.rest.issues.createComment({
57+
issue_number: context.issue.number,
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
body: '⚠️ **JetBrains Auto-Approval Compliance Check Failed**\n\n' +
61+
'This PR contains code that violates JetBrains auto-approval requirements:\n\n' +
62+
'- ❌ Do **not** use forbidden Kotlin experimental APIs\n' +
63+
'- ❌ Do **not** add lambdas, handlers, or class handles to Java runtime hooks\n' +
64+
'- ❌ Do **not** create threads manually (use coroutines or ensure cleanup in `CoderRemoteProvider#close()`)\n' +
65+
'- ❌ Do **not** bundle libraries already provided by Toolbox\n' +
66+
'- ❌ Do **not** perform ill-intentioned actions\n\n' +
67+
'Please check the workflow logs for detailed violations and fix them before merging.'
68+
})

CHANGELOG.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22

33
## Unreleased
44

5+
### Added
6+
7+
- support for matching workspace agent in the URI via the agent name
8+
9+
### Removed
10+
11+
- dropped support for `agent_id` as a URI parameter
12+
513
## 0.4.0 - 2025-07-08
614

715
### Added
816

917
- support for basic authentication for HTTP/HTTPS proxy
1018
- support for Toolbox 2.7 release
11-
- support for matching workspace agent in the URI via the agent name
1219

1320
### Changed
1421

1522
- improved message while loading the workspace
1623

17-
### Removed
18-
19-
- dropped support for `agent_id` as a URI parameter
20-
2124
### Fixed
2225

2326
- URI protocol handler is now able to switch to the Coder provider even if the last opened provider was something else

JETBRAINS_COMPLIANCE.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# JetBrains Auto-Approval Compliance
2+
3+
This document describes the linting setup to ensure compliance with JetBrains auto-approval requirements for Toolbox plugins.
4+
5+
## Overview
6+
7+
JetBrains has enabled auto-approval for this plugin, which requires following specific guidelines to maintain the approval status. This repository includes automated checks to ensure compliance.
8+
9+
## Requirements
10+
11+
Based on communication with JetBrains team, the following requirements must be met:
12+
13+
### ✅ Allowed
14+
- **Coroutines**: Use `coroutineScope.launch` for concurrent operations
15+
- **Library-managed threads**: Libraries like OkHttp with their own thread pools are acceptable
16+
- **Some experimental coroutines APIs**: `kotlinx.coroutines.selects.select` and `kotlinx.coroutines.selects.onTimeout` are acceptable
17+
- **Proper cleanup**: Ensure resources are released in `CoderRemoteProvider#close()` method
18+
19+
### ❌ Forbidden
20+
- **Kotlin experimental APIs**: Core Kotlin experimental APIs (not coroutines-specific ones)
21+
- **Java runtime hooks**: No lambdas, handlers, or class handles to Java runtime hooks
22+
- **Manual thread creation**: Avoid `Thread()`, `Executors.new*()`, `ThreadPoolExecutor`, etc.
23+
- **Bundled libraries**: Don't bundle libraries already provided by Toolbox
24+
- **Ill-intentioned actions**: No malicious or harmful code
25+
26+
## Linting Setup
27+
28+
### JetBrains Compliance with Detekt
29+
30+
The primary compliance checking is done using Detekt with custom configuration in `detekt.yml`:
31+
32+
```bash
33+
./gradlew detekt
34+
```
35+
36+
This configuration includes JetBrains-specific rules that check for:
37+
- **ForbiddenAnnotation**: Detects forbidden experimental API usage
38+
- **ForbiddenMethodCall**: Detects Java runtime hooks and manual thread creation
39+
- **ForbiddenImport**: Detects potentially bundled libraries
40+
- **Standard code quality rules**: Complexity, naming, performance, etc.
41+
42+
43+
44+
## CI/CD Integration
45+
46+
The GitHub Actions workflow `.github/workflows/jetbrains-compliance.yml` runs compliance checks on every PR and push.
47+
48+
## Running Locally
49+
50+
```bash
51+
# Run JetBrains compliance and code quality check
52+
./gradlew detekt
53+
54+
# View HTML report
55+
open build/reports/detekt/detekt.html
56+
```
57+
58+
59+
60+
## Understanding Results
61+
62+
### Compliance Check Results
63+
64+
- **✅ No critical violations**: Code complies with JetBrains requirements
65+
- **❌ Critical violations**: Must be fixed before auto-approval
66+
- **⚠️ Warnings**: Should be reviewed but may be acceptable
67+
68+
### Common Warnings
69+
70+
1. **Manual thread creation**: If you see warnings about thread creation:
71+
- Prefer coroutines: `coroutineScope.launch { ... }`
72+
- If using libraries with threads, ensure cleanup in `close()`
73+
74+
2. **Library imports**: If you see warnings about library imports:
75+
- Verify the library isn't bundled in the final plugin
76+
- Check that Toolbox doesn't already provide the library
77+
78+
3. **GlobalScope usage**: If you see warnings about `GlobalScope`:
79+
- Use the coroutine scope provided by Toolbox instead
80+
81+
## Resources
82+
83+
- [JetBrains Toolbox Plugin Development](https://plugins.jetbrains.com/docs/toolbox/)
84+
- [Detekt Documentation](https://detekt.dev/)
85+
- [Kotlin Coroutines Guide](https://kotlinlang.org/docs/coroutines-guide.html)

build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ plugins {
2222
alias(libs.plugins.gradle.wrapper)
2323
alias(libs.plugins.changelog)
2424
alias(libs.plugins.gettext)
25+
alias(libs.plugins.detekt)
2526
}
2627

2728

@@ -110,6 +111,24 @@ tasks.test {
110111
useJUnitPlatform()
111112
}
112113

114+
// Detekt configuration for JetBrains compliance and code quality
115+
detekt {
116+
config.setFrom("$projectDir/detekt.yml")
117+
buildUponDefaultConfig = true
118+
allRules = false
119+
}
120+
121+
// Configure detekt for JetBrains compliance and code quality
122+
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
123+
jvmTarget = "21"
124+
reports {
125+
html.required.set(true)
126+
xml.required.set(true)
127+
}
128+
// Fail build on detekt issues for JetBrains compliance
129+
ignoreFailures = false
130+
}
131+
113132

114133
tasks.jar {
115134
archiveBaseName.set(extension.id)

0 commit comments

Comments
 (0)