-
Notifications
You must be signed in to change notification settings - Fork 390
Add dart_skills_lint to devtools and configure it to run in the cli and in tests #9770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
reidbaker
wants to merge
6
commits into
flutter:master
Choose a base branch
from
reidbaker:r-add-dart-skills-lint-to-devtools-v1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2661c38
add dart skills lint test and yaml config with instructions for how t…
reidbaker fed7a84
Add ignore file for valid links that are triggering false positives
reidbaker 9c290a1
resolve readme to correct location
reidbaker eb5547b
Copyright added to new files and issue linked in pubspec
reidbaker 92e8b56
Add link to yaml configuration feature
reidbaker cbc4b02
presubmit feedback
reidbaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <!-- | ||
| Copyright 2026 The Flutter Authors | ||
| Use of this source code is governed by a BSD-style license that can be | ||
| found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| --> | ||
|
|
||
| # Agent Skills | ||
|
|
||
| This directory contains AI agent skills for this repository. | ||
|
|
||
| ## Validation | ||
|
|
||
| To ensure skills meet the required specification, they are automatically validated in pre-submit checks. | ||
| You should also validate your skills locally before submitting a review. | ||
|
|
||
| ### Running the Linter Locally | ||
|
|
||
| To validate skills locally before review, run the linter from the root of the repository: | ||
|
|
||
| ```bash | ||
| dart run dart_skills_lint:cli | ||
| ``` | ||
|
|
||
| This will use the configuration in `dart_skills_lint.yaml` to validate all skills in the `.agents/skills` directory. | ||
|
|
||
| Or for a single skill: | ||
|
|
||
| ```bash | ||
| dart run dart_skills_lint:cli --skill .agents/skills/my-skill | ||
| ``` | ||
|
|
||
| ### Running via Dart Test | ||
|
|
||
| Alternatively, you can run the validation as a test from the `tool` directory: | ||
|
|
||
| ```bash | ||
| cd tool && dart test test/validate_skills_test.dart | ||
| ``` | ||
|
|
||
| This ensures that the validation logic is executed in the same way as in CI. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are required because of flutter/skills#83 which will be addressed by flutter/skills#84 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "skills": { | ||
| "adding-release-notes": [ | ||
| { | ||
| "rule_id": "check-relative-paths", | ||
| "file_name": "SKILL.md" | ||
| } | ||
| ], | ||
| "preparing-pr": [ | ||
| { | ||
| "rule_id": "check-relative-paths", | ||
| "file_name": "SKILL.md" | ||
| } | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright 2026 The Flutter Authors | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| dart_skills_lint: | ||
| rules: | ||
| check-relative-paths: error | ||
| check-absolute-paths: error | ||
| check-trailing-whitespace: error | ||
| directories: | ||
| - path: ".agents/skills" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright 2026 The Flutter Authors | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
|
|
||
| import 'dart:async'; | ||
|
reidbaker marked this conversation as resolved.
|
||
| import 'package:dart_skills_lint/dart_skills_lint.dart'; | ||
| import 'package:logging/logging.dart'; | ||
| import 'package:test/test.dart'; | ||
|
|
||
| void main() { | ||
| test('Validate DevTools Skills', () async { | ||
| final Level oldLevel = Logger.root.level; | ||
| Logger.root.level = Level.ALL; | ||
| final StreamSubscription<LogRecord> subscription = Logger.root.onRecord.listen((record) { | ||
| print(record.message); | ||
| }); | ||
|
|
||
| try { | ||
| // Update test to use dart_skills_lint.yaml for config when available. | ||
| // See https://github.com/flutter/skills/issues/85. | ||
| final bool isValid = await validateSkills( | ||
| skillDirPaths: ['../.agents/skills'], | ||
| resolvedRules: { | ||
| 'check-relative-paths': AnalysisSeverity.error, | ||
| 'check-absolute-paths': AnalysisSeverity.error, | ||
| 'check-trailing-whitespace': AnalysisSeverity.error, | ||
|
reidbaker marked this conversation as resolved.
|
||
| }, | ||
| ); | ||
| expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.'); | ||
| } finally { | ||
| Logger.root.level = oldLevel; | ||
| await subscription.cancel(); | ||
| } | ||
| }); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.