Skip to content

Commit 92f9d74

Browse files
kenzieschmollrishika0212
authored andcommitted
Add customization for the Gemini Code Assist review bot (flutter#9774)
1 parent 321b46f commit 92f9d74

5 files changed

Lines changed: 109 additions & 17 deletions

File tree

.gemini/config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Customize Gemini Code Assist behavior for DevTools.
2+
#
3+
# Schema: https://developers.google.com/gemini-code-assist/docs/customize-repo-review#config.yaml-schema
4+
# Based on Flutter config: https://github.com/flutter/flutter/blob/master/.gemini/config.yaml
5+
6+
# Minimize verbosity.
7+
have_fun: false
8+
9+
code_review:
10+
# (DEFAULT) - Include field in the config for easy shut off if needed.
11+
disable: false
12+
# LOW, MEDIUM, HIGH or CRITICAL.
13+
comment_severity_threshold: MEDIUM
14+
# (DEFAULT) -1 is unlimited.
15+
max_review_comments: -1
16+
pull_request_opened:
17+
# (DEFAULT) Explicitly set help to false in case the default changes in the
18+
# future, as having a help message on every PR would be spammy.
19+
help: false
20+
# These tend to be verbose, and since we expect PR authors to clearly
21+
# describe their PRs this would be at best duplicative.
22+
summary: false
23+
# Avoid comments on draft PRs.
24+
include_drafts: false
25+
26+
ignore_patterns:
27+
# Ignore third party files by default
28+
- "**/third_party/**"

.gemini/styleguide.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# DevTools Style Guide for Gemini Code Assist
2+
3+
This style guide outlines the coding conventions for the DevTools repository to help Gemini Code Assist provide effective code reviews. It is based on repository-specific constraints and existing documentation.
4+
5+
**Persona**: You are an expert Dart and Flutter developer rooted in best practices. Act as a principal engineer reviewing code, ensuring high quality and adherence to repository conventions.
6+
7+
## 1. AI Review Protocol (Noise Reduction)
8+
9+
- **Zero-Formatting Policy:** Do NOT comment on indentation, spacing, or brace placement. We use `dart format`
10+
and the CI testing ensures that the code is formatted correctly.
11+
- **Categorize Severity:** Prefix every comment with a severity:
12+
- `[MUST-FIX]`: Security holes, import violations, or logical bugs.
13+
- `[CONCERN]`: Maintainability issues, high duplication, or "clever" code that is hard to read.
14+
- `[NIT]`: Idiomatic improvements or minor naming suggestions.
15+
- **Focus:** Prioritize logic, performance on the UI thread, and architectural consistency.
16+
- **No Empty Praise:** Do not leave "Looks good" or "Nice change" comments. If there are no issues, leave no comments.
17+
- **Copyright Headers:** Ensure all new files have a proper copyright header with the current year. For example:
18+
```
19+
// Copyright 2026 The Flutter Authors
20+
// Use of this source code is governed by a BSD-style license that can be
21+
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
22+
```
23+
Flag missing copyright headers as `[MUST-FIX]`.
24+
25+
## 2. Key Principles
26+
27+
* **Readability**: Code should be easy to understand for all contributors.
28+
* **Maintainability**: Code should be easy to modify and extend without breaking other screens.
29+
* **Consistency**: Adhering to consistent style across all DevTools packages improves collaboration and reduces errors.
30+
* **Code Reuse**: Use shared primitives and components rather than recreating them from scratch.
31+
* **Testing**: All changes should include automated tests to ensure correctness and prevent regressions.
32+
33+
## 3. Guidelines from Existing Documentation
34+
35+
Please refer to the following files for specific rules:
36+
37+
* **General Style Context**: See [STYLE.md](STYLE.md) for rules on:
38+
* Getter and setter order.
39+
* Naming for typedefs and function variables.
40+
* Overriding equality.
41+
* Windows/POSIX path handling conventions.
42+
* Default text styles.
43+
* **Repository Constraints**: See [AGENTS.md](AGENTS.md) for rules on:
44+
* Constraints on `packages/devtools_shared` (no Flutter dependency).
45+
* Import restrictions (no importing `devtools_app.dart` from `src/`).
46+
* Published packages management (CHANGELOGs, versions, breaking changes).
47+
* Code quality (DRY, Meaningful Naming).
48+
* Strict avoidance of raw values in UI (use named constants).
49+
* Usage of established themes and text styles.
50+
* Usage of shared components and utilities.
51+
* Widget structure (avoiding long build methods, widgets vs methods).

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ DEPENDENCIES.md
4343
**/logs/**
4444
*.stager_app.g.dart
4545

46-
# Ignore Gemini logs
47-
**/.gemini/
48-
4946
# Ignore VS code workspaces that may be configured per-user
5047
*.code-workspace
5148

AGENTS.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,33 @@ Follow these rules when working in this repository.
88
- **`packages/devtools_shared`**: Never introduce a Flutter dependency or a dependency on web-only Dart libraries.
99
- **Imports**: Never import `packages/devtools_app/lib/devtools_app.dart` in code under `packages/devtools_app/lib/src/`. It is acceptable in test code.
1010

11+
### Published Packages (`packages/devtools_shared`, `packages/devtools_app_shared`, `packages/devtools_extensions`)
12+
- Document file changes in the respective `CHANGELOG.md` files.
13+
- Ensure version numbers in `pubspec.yaml` are updated accordingly for required changes.
14+
- Ensure no breaking changes are introduced. If introduced, they must be intentional and documented.
15+
- The published packages should not depend on unpublished packages like `packages/devtools_app` and `packages/devtools_test`.
16+
1117
### Code Style
1218
- **Style Guide**: Follow the DevTools style guide in [STYLE.md](STYLE.md).
1319
- **Formatting & Analysis**: Always ensure code is formatted properly and has no analysis errors or warnings before completing a task.
1420

15-
## Running Tests
21+
### Code Quality & Maintainability
22+
- **DRY (Don't Repeat Yourself)**: Identify blocks of code that are 90%+ identical to existing utility methods in this repo and flag them for duplication.
23+
- **Meaningful Naming**: Variables should describe their intent (e.g., `timeoutInMs` instead of `t`).
24+
- **Descriptive Pull Request**: Contributors should include the information recommended in the pull request template (in `.github/PULL_REQUEST_TEMPLATE.md`).
25+
26+
## Documentation
27+
- All public members should have documentation.
28+
- **Answer your own questions**: If you have a question, find the answer, and then document it where you first looked.
29+
- **Documentation should be useful**: Explain the *why* and the *how*.
30+
- **Introduce terms**: Assume the reader does not know everything. Link to definitions.
31+
- Use `///` for public-quality documentation, even on private members.
1632

33+
## Running Tests
1734
- **Standard Packages**: Run unit and widget tests with `flutter test`.
1835
- **`packages/devtools_shared`**: Run tests with `dart test`.
1936
- **Integration Tests**: Refer to the [Integration Test README](packages/devtools_app/integration_test/README.md) for instructions on running integration tests.
2037

21-
## Tooling Best Practices
22-
23-
- **MCP Tools**: Prefer using MCP server tools over shell commands whenever possible.
24-
2538
## UI Development Guidelines
2639

2740
### Constants and Magic Values
@@ -34,3 +47,6 @@ Follow these rules when working in this repository.
3447
### Code Reuse
3548
- **Use Shared Components & Utils**: Prefer using reusable components from `shared/ui/` (such as `packages/devtools_app/lib/src/shared/ui/common_widgets.dart`), primitives from `shared/primitives/`, and utilities from `shared/utils/` rather than creating things from scratch.
3649

50+
### Helper Widgets and Methods
51+
- **Avoid Long Build Methods**: Use separate helper widgets instead of writing excessively long build methods to keep the structure clear.
52+
- **Prefer Widgets Over Methods**: Create small, composable helper widgets rather than helper methods that return a widget at build time. This improves readability and allows Flutter to optimize tree updates better.

STYLE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ found in the LICENSE file or at https://developers.google.com/open-source/licens
66
# DevTools style guide
77

88
We fully follow [Effective Dart](https://dart.dev/effective-dart)
9-
and some items of
10-
[Style guide for Flutter repo](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md):
9+
and certain guidelines from the
10+
[Flutter repository style guide](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md):
1111

1212
## Order of getters and setters
1313

14-
When an object owns and exposes a (listenable) value,
15-
more complicated than just public field
16-
we declare the related class members always in the same order,
14+
When an object owns and exposes a (listenable) value
15+
that is more complex than a simple public field,
16+
we always declare the related class members in the same order,
1717
without new lines separating the members,
1818
in compliance with
1919
[Flutter repo style guide](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#order-other-class-members-in-a-way-that-makes-sense):
@@ -41,10 +41,10 @@ converted to paths when required to interact with the file system.
4141

4242
Additionally:
4343

44-
- `Uri.parse()` should not be used for converting file paths to URIs, instead
45-
`Uri.file()` should be used
46-
- `Uri.path` should not be used for extracting a file path from a URI, instead
47-
`uri.toFilePath()` should be used
44+
- `Uri.parse()` should not be used for converting file paths to URIs; instead,
45+
`Uri.file()` should be used.
46+
- `Uri.path` should not be used for extracting a file path from a URI; instead,
47+
`uri.toFilePath()` should be used.
4848
- In code compiled to run in the browser, `Uri.file()` and `uri.toFilePath()`
4949
will assume POSIX-style paths even on Windows, so care should be taken to
5050
handle these correctly (if possible, avoid converting between URIs and file

0 commit comments

Comments
 (0)