feat(rules): add no-error-throw and no-assert rules for daw-code pack #67

Closed
opened 2026-05-25 19:59:15 +02:00 by michael · 1 comment
Owner

Goal

Add rules to detect direct use of error() and assert() in Lua modules.
DAW standard requires nil, err return instead.

Rules

no-error-throw:
primitive: pattern
pattern: "error("
file_pattern: "*.lua"
severity: warn
message: "{file}: error() found -- use nil, err instead"

no-assert:
primitive: pattern
pattern: "assert("
file_pattern: "*.lua"
severity: warn
message: "{file}: assert() found -- use nil, err instead"

Notes

Both rules need file_exclude for test files where assert() is expected.
Belongs in daw-code pack.

## Goal Add rules to detect direct use of error() and assert() in Lua modules. DAW standard requires nil, err return instead. ## Rules no-error-throw: primitive: pattern pattern: "error(" file_pattern: "*.lua" severity: warn message: "{file}: error() found -- use nil, err instead" no-assert: primitive: pattern pattern: "assert(" file_pattern: "*.lua" severity: warn message: "{file}: assert() found -- use nil, err instead" ## Notes Both rules need file_exclude for test files where assert() is expected. Belongs in daw-code pack.
Author
Owner

Implemented: no-error-throw and no-assert added to daw-lua-code pack.

2 hits in fragjan: main.lua:68 (assert), core/reporter.lua:49 (error).

Implemented: no-error-throw and no-assert added to daw-lua-code pack. 2 hits in fragjan: main.lua:68 (assert), core/reporter.lua:49 (error).
michael 2026-05-26 16:01:32 +02:00
michael added this to the Basic Version milestone 2026-05-30 16:04:44 +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#67
No description provided.