feat(rules): add no-direct-getenv rule for daw-code pack #74

Closed
opened 2026-05-25 20:45:39 +02:00 by michael · 2 comments
Owner

Goal

Add rule to detect os.getenv calls outside of sys.lua.
Only sys.lua is allowed to read the OS environment directly.

Rule

no-direct-getenv:
primitive: pattern
pattern: "os.getenv"
file_pattern: ".lua"
file_exclude: "
/sys.lua"
severity: error
message: "{file}: os.getenv found -- environment access belongs in sys.lua only"

Known violation

Notes

Belongs in daw-code pack.

## Goal Add rule to detect os.getenv calls outside of sys.lua. Only sys.lua is allowed to read the OS environment directly. ## Rule no-direct-getenv: primitive: pattern pattern: "os.getenv" file_pattern: "*.lua" file_exclude: "*/sys.lua" severity: error message: "{file}: os.getenv found -- environment access belongs in sys.lua only" ## Known violation - daw-modul-berhtjan-core/lang.lua (DAW/daw-modul-berhtjan-core#8) ## Notes Belongs in daw-code pack.
Author
Owner

file_exclude must cover bin/wrapper scripts in addition to sys.lua. Exact exclude pattern depends on wrapper naming convention.

file_exclude must cover bin/wrapper scripts in addition to sys.lua. Exact exclude pattern depends on wrapper naming convention.
Author
Owner

Implemented: no-direct-getenv added to daw-lua-code pack, file_exclude covers test/*.lua and sys.lua only.

Hit confirmed in daw-modul-berhtjan-core/lang.lua:11 as expected (DAW/daw-modul-berhtjan-core#8).

Implemented: no-direct-getenv added to daw-lua-code pack, file_exclude covers test/*.lua and sys.lua only. Hit confirmed in daw-modul-berhtjan-core/lang.lua:11 as expected (DAW/daw-modul-berhtjan-core#8).
michael 2026-05-26 16:51:04 +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#74
No description provided.