Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dart_hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
agent_dart_format.dart: true
agent_dart_analyze.dart: true
DartFormatHook: true
DartAnalyzeHook: true
4 changes: 2 additions & 2 deletions tool/dart_hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
agent_dart_format.dart: true
agent_dart_analyze.dart: true
DartFormatHook: true
DartAnalyzeHook: true
4 changes: 2 additions & 2 deletions tool/dart_hooks/dart_hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
agent_dart_format.dart: true
agent_dart_analyze.dart: true
DartFormatHook: true
DartAnalyzeHook: true
4 changes: 3 additions & 1 deletion tool/dart_hooks/lib/src/base_hook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ abstract class BaseHook {
final dynamic yaml = loadYaml(configContent);
if (yaml is Map) {
if (!yaml.containsKey(configKey)) {
final String foundKeys = yaml.keys.join(', ');
await logToFile(
'Hook $hookName is disabled (key "$configKey" is missing in configuration).',
'Hook $hookName is disabled (key "$configKey" is missing in configuration). '
'Found keys: [$foundKeys]. Did you mean to enable it with "$configKey: true"?',
);
printStdout(jsonEncode({'decision': 'stop'}));
onExit(0);
Expand Down
4 changes: 4 additions & 0 deletions tool/dart_hooks/test/base_hook_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ void main() {
loggedMessages.first,
contains('is disabled (key "test_hook" is missing in configuration)'),
);
// Verify the warning surfaces the keys that were found so a typo'd or
// legacy key (e.g. a script filename) does not silently disable a hook.
expect(loggedMessages.first, contains('Found keys: [other_hook].'));
expect(loggedMessages.first, contains('"test_hook: true"'));
});

test('Disabled setting logs disabled', () async {
Expand Down
4 changes: 2 additions & 2 deletions tool/dart_skills_lint/dart_hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
agent_dart_format.dart: true
agent_dart_analyze.dart: true
DartFormatHook: true
DartAnalyzeHook: true
Loading