Skip to content

Add comprehensive function definition × call catalog - #6

Open
ekohilas wants to merge 3 commits into
mainfrom
claude/repo-pr-access-0nxcym
Open

Add comprehensive function definition × call catalog#6
ekohilas wants to merge 3 commits into
mainfrom
claude/repo-pr-access-0nxcym

Conversation

@ekohilas

@ekohilas ekohilas commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

This PR introduces a comprehensive, verdict-free catalog of Python function definitions and calls. The catalog serves as a shared test-case corpus for argument-related lint rules, organizing cases along orthogonal dimensions (parameter kinds, callable kinds, argument forms, etc.) without prescribing pass/fail verdicts.

Key Changes

  • New catalog/ package with 8 category modules covering distinct aspects of function definitions and calls:

    • param_kinds.py — parameter shapes (positional-only, keyword-only, *args, **kwargs, etc.)
    • callable_kinds.py — callable types (module functions, methods, classmethods, lambdas, properties, etc.)
    • arg_forms.py — argument expressions at call sites (literals, variables, attributes, unpacking, etc.)
    • unpacking.py — iterable/mapping unpacking (*seq, **mapping) and inferability
    • arity_and_ordering.py — argument count and ordering (exact, defaults-omitted, too-few, reordered, etc.)
    • call_target_forms.py — how callables are referenced (bare names, attributes, subscripts, etc.)
    • source_and_inferability.py — definition source and astroid inference capability
    • defaults_and_annotations.py — parameter defaults and type annotations
    • cross_cutting.py — combinations that span multiple axes (redundant keywords, shadowing builtins, etc.)
  • Schema and validation (_schema.py):

    • Case dataclass pairing definition and call snippets with dimension tags
    • Controlled vocabulary for all tag values
    • validate() function for structural integrity checks
    • marked_source() helper for astroid node extraction
  • Test harness (test/test_catalog.py):

    • Validates all cases parse correctly under astroid
    • Checks ID uniqueness and well-formedness
    • Records (but does not assert) inferability and plugin behavior
  • Documentation (catalog/README.md):

    • Explains the verdict-free design philosophy
    • Documents the 10 orthogonal dimensions
    • Provides guidance for rule authors using the catalog
  • Configuration (pyproject.toml):

    • Added pytest configuration to make the catalog package importable during tests

Notable Design Details

  • Verdict-free: Cases carry only dimension tags and notes, never pass/fail verdicts. This allows one corpus to serve multiple rules.
  • Orthogonal dimensions: Each category isolates one axis while holding others canonical (e.g., arg_forms.py varies argument expressions while keeping signature shape, source, and inferability constant).
  • Inferability tracking: Cases record whether astroid can fully/partially/not infer the callable, enabling rules to bail safely on uninferable targets.
  • Real-world coverage: Includes edge cases like conditional defs with ambiguous signatures, multiplicity of inference, C builtins, and stub-only definitions.
  • Runnable validation: All cases are validated to parse and execute under the real astroid toolchain, ensuring the corpus stays in sync with the linter.

https://claude.ai/code/session_01LRN8aXwbrHyqZ15QyZHSFM

claude added 3 commits July 1, 2026 02:29
Introduce a verdict-free, tag-annotated catalog of the ways a Python
function can be defined and called, as the shared test-case corpus for the
argument lint rules. Each case pairs a definition snippet with a call
snippet and tags it along orthogonal dimensions; a human decides per rule
which combinations should violate.

- catalog/_schema.py: Case dataclass, controlled vocabulary, validate()
- catalog/README.md: authoring contract for concurrent extension
- test/test_catalog.py: structural validation (parses, unique ids, schema),
  records (not asserts) inferability + plugin behaviour
- pyproject.toml: pytest pythonpath for the catalog package
- populated categories so far: param_kinds, defaults_and_annotations,
  callable_kinds, unpacking, arg_forms, call_target_forms

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LRN8aXwbrHyqZ15QyZHSFM
Full function definition×call catalog now populated across 9 categories
(232 tag-annotated, verdict-free cases). All 467 structural checks pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LRN8aXwbrHyqZ15QyZHSFM
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.

2 participants