← Back to issue list

Checker for grammar processor should be optional

View original Github issue

Metadata

Project
craft-grammar
Number
#131
Type
issue
State
closed
Author
mr-cal
Labels
Type: Enhancement Status: Triaged
Created
Updated
Closed

Current evaluation

Resolved: PR canonical/craft-grammar#133 (commit 9b70aa6) merged, making GrammarProcessor's checker optional with a default no-op lambda, closing #131.

Resolution: closed resolved

Reason: PR #133 'feat(GrammarProcessor): make `checker` optional' was merged as commit 9b70aa6 in the _processor.py history, adopting the no-op lambda approach suggested in the issue thread and demonstrated in craft-application PR #899. The issue was closed as fixed by that merge.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The [`checker` parameter](https://github.com/canonical/craft-grammar/blob/0408961a5dc7c7dd4961190b43b109d03ac9b508/craft_grammar/_processor.py#L61) for a GrammarProcessor should be optional. This is because it isn't always required, but it takes a non-trivial amount of code to make it a no-op ([example](https://github.com/canonical/craft-application/blob/4d6c68cb7421e06375f0d35c59a3b654e36264c6/craft_application/grammar.py#L127-L138)).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Resolved: PR canonical/craft-grammar#133 (commit 9b70aa6) merged, making GrammarProcessor's checker optional with a default no-op lambda, closing #131.
stealth/space-bunny-alpha — closed resolved Made GrammarProcessor.checker optional with a no-op default; the fix merged in canonical/craft-grammar#133 via commit 9b70aa6.
qwen/qwen3.6-35b-a3b — — Resolved by making the checker parameter optional, defaulting to a lambda function to eliminate boilerplate. The proposed approach was approved and implemented.
qwen/qwen3.6-35b-a3b — — The checker parameter for GrammarProcessor was made optional by setting a lambda as the default value. The maintainer approved the fix, which was merged to close the enhancement request.
qwen/qwen3.6-35b-a3b — — Resolved by implementing a no-op lambda as the default checker value. A proposed pull request was approved by the maintainer, and the team agreed to use the lambda as the default, closing the enhancement request.
qwen/qwen3.6-35b-a3b — — The checker parameter in GrammarProcessor was made optional by using a lambda as the default value. The enhancement was resolved and merged via a related pull request after maintainer approval.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-grammar#133 (confidence 95%)

    Merged PR implementing the enhancement, commit 9b70aa6; fixes #131.

  • Related To: canonical/craft-application#899 (confidence 60%)

    Referenced in the discussion as the existing example that made checker a no-op, motivating the lambda default.

Related issues

Issue Project State Summary Similarity
#133 feat(GrammarProcessor): make `checker` optional craft-grammar merged PR #133 merged (commit 9b70aa6), making GrammarProcessor's `checker` optional with a default no-op (lambda _: True); closes #131 and shipped in release 2.3.0.
82%
#899 test: simpler checker no-op for grammar craft-application open Removes the `self_check` no-op workaround from craft_application/grammar.py now that craft-grammar>=2.3.0 makes GrammarProcessor.checker optional (fixes craft-grammar#131). Approved, all CI green, open 388 days.
74%