Files
noteflow/.claude/hookify.block-any-type.local.md

1.4 KiB

name, enabled, event, action, conditions
name enabled event action conditions
block-any-type true file block
field operator pattern
file_path regex_match .(py|pyi)$
field operator pattern
new_text regex_match (from\s+typing\s+import\s+[^#\n]*\bAny\b|:\s*Any\b|:\s*"Any"|:\s*'Any'|->\s*Any\b|->\s*"Any"|->\s*'Any'|[\s*Any\s*]|[\s*Any\s*,|,\s*Any\s*]|,\s*Any\s*,|Union[.*\bAny\b.*]|Optional[Any])

🚫 BLOCKED: Insecure Any Type Usage Detected

You are attempting to use Any as a type annotation, which is strictly forbidden in this codebase.

Why Any is Forbidden

  • Any bypasses all type checking, defeating the purpose of static analysis
  • It creates type safety holes that propagate through the codebase
  • It hides bugs that would otherwise be caught at compile time
  • It makes refactoring dangerous and error-prone

What to Do Instead

  1. Use specific types: str, int, dict[str, int], list[MyClass]
  2. Use object: When you truly need the base type
  3. Use Protocol: For structural typing / duck typing
  4. Use TypeVar: For generic type parameters
  5. Use union types: str | int | None instead of Any

Need Help?

Run the /type-strictness skill to get guidance on proper type annotations for your specific use case.

/type-strictness

This skill will help you find the correct specific type to use instead of Any.