This document describes the linting setup to ensure compliance with JetBrains auto-approval requirements for Toolbox plugins.
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.
Based on communication with JetBrains team, the following requirements must be met:
- Coroutines: Use
coroutineScope.launchfor concurrent operations - Library-managed threads: Libraries like OkHttp with their own thread pools are acceptable
- Some experimental coroutines APIs:
kotlinx.coroutines.selects.selectandkotlinx.coroutines.selects.onTimeoutare acceptable - Proper cleanup: Ensure resources are released in
CoderRemoteProvider#close()method
- Kotlin experimental APIs: Core Kotlin experimental APIs (not coroutines-specific ones)
- Java runtime hooks: No lambdas, handlers, or class handles to Java runtime hooks
- Manual thread creation: Avoid
Thread(),Executors.new*(),ThreadPoolExecutor, etc. - Bundled libraries: Don't bundle libraries already provided by Toolbox
- Ill-intentioned actions: No malicious or harmful code
The primary compliance checking is done using Detekt with custom configuration in detekt.yml:
./gradlew detektThis configuration includes JetBrains-specific rules that check for:
- ForbiddenAnnotation: Detects forbidden experimental API usage
- ForbiddenMethodCall: Detects Java runtime hooks and manual thread creation
- ForbiddenImport: Detects potentially bundled libraries
- Standard code quality rules: Complexity, naming, performance, etc.
The GitHub Actions workflow .github/workflows/jetbrains-compliance.yml runs compliance checks on every PR and push.
# Run JetBrains compliance and code quality check
./gradlew detekt
# View HTML report
open build/reports/detekt/detekt.html- ✅ No critical violations: Code complies with JetBrains requirements
- ❌ Critical violations: Must be fixed before auto-approval
⚠️ Warnings: Should be reviewed but may be acceptable
-
Manual thread creation: If you see warnings about thread creation:
- Prefer coroutines:
coroutineScope.launch { ... } - If using libraries with threads, ensure cleanup in
close()
- Prefer coroutines:
-
Library imports: If you see warnings about library imports:
- Verify the library isn't bundled in the final plugin
- Check that Toolbox doesn't already provide the library
-
GlobalScope usage: If you see warnings about
GlobalScope:- Use the coroutine scope provided by Toolbox instead