diff --git a/dart_hooks.yaml b/dart_hooks.yaml index 534acef..a508505 100644 --- a/dart_hooks.yaml +++ b/dart_hooks.yaml @@ -1,2 +1,2 @@ -agent_dart_format.dart: true -agent_dart_analyze.dart: true +DartFormatHook: true +DartAnalyzeHook: true diff --git a/tool/dart_hooks.yaml b/tool/dart_hooks.yaml index 534acef..a508505 100644 --- a/tool/dart_hooks.yaml +++ b/tool/dart_hooks.yaml @@ -1,2 +1,2 @@ -agent_dart_format.dart: true -agent_dart_analyze.dart: true +DartFormatHook: true +DartAnalyzeHook: true diff --git a/tool/dart_hooks/dart_hooks.yaml b/tool/dart_hooks/dart_hooks.yaml index 534acef..a508505 100644 --- a/tool/dart_hooks/dart_hooks.yaml +++ b/tool/dart_hooks/dart_hooks.yaml @@ -1,2 +1,2 @@ -agent_dart_format.dart: true -agent_dart_analyze.dart: true +DartFormatHook: true +DartAnalyzeHook: true diff --git a/tool/dart_hooks/lib/src/base_hook.dart b/tool/dart_hooks/lib/src/base_hook.dart index 3b35091..dcd7720 100644 --- a/tool/dart_hooks/lib/src/base_hook.dart +++ b/tool/dart_hooks/lib/src/base_hook.dart @@ -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); diff --git a/tool/dart_hooks/test/base_hook_test.dart b/tool/dart_hooks/test/base_hook_test.dart index e57e28d..5167f27 100644 --- a/tool/dart_hooks/test/base_hook_test.dart +++ b/tool/dart_hooks/test/base_hook_test.dart @@ -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 { diff --git a/tool/dart_skills_lint/dart_hooks.yaml b/tool/dart_skills_lint/dart_hooks.yaml index 534acef..a508505 100644 --- a/tool/dart_skills_lint/dart_hooks.yaml +++ b/tool/dart_skills_lint/dart_hooks.yaml @@ -1,2 +1,2 @@ -agent_dart_format.dart: true -agent_dart_analyze.dart: true +DartFormatHook: true +DartAnalyzeHook: true