Skip to content

Align yaml and validateSkills dart api#130

Merged
reidbaker merged 11 commits into
flutter:mainfrom
reidbaker:i85-align-yaml-custom-test
May 12, 2026
Merged

Align yaml and validateSkills dart api#130
reidbaker merged 11 commits into
flutter:mainfrom
reidbaker:i85-align-yaml-custom-test

Conversation

@reidbaker

@reidbaker reidbaker commented May 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #85

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@reidbaker reidbaker changed the title i85 align yaml custom test Align yaml and validateSkills dart api May 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several enhancements to the dart_skills_lint tool, including tilde expansion for paths, improved configuration loading, and better documentation regarding CLI vs. Dart Test usage. Key changes include moving path expansion logic to a utility file, refactoring validateSkillsInternal to handle default skill directories more robustly, and adding a new test suite to ensure the repository's own skills are validated. Feedback highlights a missing tilde expansion in the configuration parser, a discrepancy between documentation and the actual exception thrown, and a recommendation to use absolute paths for more reliable directory matching. Additionally, the reviewer noted that the new test suite may skip default rules by only passing configured rules, and suggested making the tilde expansion utility more robust to handle the base ~ path.

Comment thread tool/dart_skills_lint/lib/src/config_parser.dart Outdated
Comment thread tool/dart_skills_lint/lib/src/validation_session.dart Outdated
Comment thread tool/dart_skills_lint/lib/src/config_parser.dart Outdated
Comment thread tool/dart_skills_lint/lib/src/path_utils.dart
Comment thread tool/dart_skills_lint/test/dart_skills_lint_skills_test.dart Outdated
@reidbaker

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates dart_skills_lint to version 0.3.0, introducing several enhancements and refactorings. Key changes include exposing the ConfigParser.loadConfig() API, supporting tilde expansion (~/) in configuration paths, and refactoring fallback logic for skills directories into validateSkillsInternal. The rule precedence logic was also updated to ensure CLI flags correctly override configuration file settings. Feedback focuses on improving the robustness of path matching to avoid false positives with directory prefixes and ensuring consistent tilde expansion across the new public API.

Comment thread tool/dart_skills_lint/lib/src/validation_session.dart
Comment thread tool/dart_skills_lint/lib/src/config_parser.dart Outdated
///
/// If a [path] is explicitly provided and the file does not exist, this
/// method throws a [FileSystemException]. If no path is provided and the
/// default file is missing, it returns an empty [Configuration] (preserving

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of "Preserving current behavior"

/// [config] is the loaded configuration.
///
/// Returns `true` if all validations passed (or if generating a baseline), `false` otherwise.
Future<bool> validateSkills({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document meaning of return value.

);

exitCode = success ? 0 : 1;
bool success;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicitly set the value for readability

ignoreFileOverride: ignoreFileOverride,
config: config,
);
exitCode = success ? 0 : 1;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use a ternary here.

Configuration? config,
List<SkillRule> customRules = const [],
}) async {
var effectiveSkillDirPaths = List<String>.from(skillDirPaths);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break out the logic to get effectiveSkillDirPaths into a method with documentation around how the paths are joined.

import 'package:path/path.dart' as p;
import 'package:test/test.dart';

void main() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of code duplication in this file. Figure out what make sense to extract.

resolved,
isEmpty,
reason:
'Defaults are now handled by Validator, so resolveRules should return empty map when no overrides.',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Defaults are now handled" This is an antipattern the meaning of "now" changes over time. Should this test be removed? I am not sure it is valuable.

});

test('config overrides defaults', () {
test('ignores config rules', () {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this test still valuable?

Comment thread tool/dart_skills_lint/CHANGELOG.md Outdated
Comment on lines +5 to +6
- Refactored fallback logic for skills directories to `validateSkillsInternal`.
- Added tests for path utilities and configuration loading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelogs should be about information the users should care about. Internal logic reorganization should not be included.

@reidbaker

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates dart_skills_lint to version 0.3.0, introducing tilde expansion for paths, exposing the ConfigParser.loadConfig() API, and implementing a clear rule precedence hierarchy (Global Config, Path-Specific Config, and CLI Overrides). It also adds documentation regarding CLI versus Dart Test usage and establishes a policy against using relative temporal words in documentation. Review feedback highlights opportunities to improve rule and ignore file resolution for nested directory structures and suggests more robust error handling for YAML parsing failures to avoid silent fallbacks to default settings.

Comment thread tool/dart_skills_lint/lib/src/validation_session.dart
Comment thread tool/dart_skills_lint/lib/src/config_parser.dart Outdated
Comment thread tool/dart_skills_lint/lib/src/validation_session.dart Outdated
Comment thread tool/dart_skills_lint/lib/src/validation_session.dart
@reidbaker reidbaker merged commit e449787 into flutter:main May 12, 2026
7 checks passed
@reidbaker reidbaker deleted the i85-align-yaml-custom-test branch May 12, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow validation to take in a yaml file with the config so that tests and manual commands can automatically stay in sync.

1 participant