fix(checks): no-error-discard misses aligned discard pattern with extra whitespace #112

Closed
opened 2026-06-02 08:06:03 +02:00 by michael · 1 comment
Owner

Problem

The no-error-discard check detects , _ but not , _ (with
whitespace between comma and underscore). Aligned code like:

local conf_raw, _    = fs.read_file(conf_path)
local has_contrib, _ = fs.read_file(contrib_path)

The second line is detected, the first is not.

Expected behaviour

Both patterns should be detected regardless of whitespace between
, and _.

Fix

Normalize whitespace in the discard pattern match:
,%s*_ instead of , _

## Problem The no-error-discard check detects `, _` but not `, _ ` (with whitespace between comma and underscore). Aligned code like: ```lua local conf_raw, _ = fs.read_file(conf_path) local has_contrib, _ = fs.read_file(contrib_path) ``` The second line is detected, the first is not. ## Expected behaviour Both patterns should be detected regardless of whitespace between `, ` and `_`. ## Fix Normalize whitespace in the discard pattern match: `,%s*_` instead of `, _`
michael added this to the Basic Version milestone 2026-06-02 18:22:26 +02:00
Author
Owner

Fixed in var/rules/daw-lua-code/rules/no-error-discard.yaml by adding
normalize_whitespace: true to the linepattern check params.

The linepattern primitive already supported this option -- no primitive
changes required. Verified against daw-modul-berhtjan-core: aligned
discard patterns are now detected correctly.

Fixed in var/rules/daw-lua-code/rules/no-error-discard.yaml by adding `normalize_whitespace: true` to the linepattern check params. The linepattern primitive already supported this option -- no primitive changes required. Verified against daw-modul-berhtjan-core: aligned discard patterns are now detected correctly.
michael 2026-06-02 18:36:26 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#112
No description provided.