bug(rules): no-direct-sys-new fires on string literals containing module name #110
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type/architecture
type
bug
type
config
type
deployment
type
docs
type/documentation
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type
research
type
security
type/task
type/tech-debt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/fragjan#110
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
no-direct-sys-newrule matches the stringdaw.common.sysanywherein a line, including inside string literals used for error messages.
Example
This line does not call
daw.common.sys-- it only references the namein an error message string. The rule fires a false positive.
Expected Behaviour
The rule should only match actual require() calls or method calls on
daw.common.sys, not string literals containing the module name.
Acceptance Criteria
no-direct-sys-newdoes not fire on string literalsrequire("daw.common.sys")and.new()calls still detectedNotes
Same pattern likely affects other rules that match module names
(e.g. no-direct-io-stderr, no-unprotected-require).
May require match_type or context awareness in the pattern primitive.
Investigated. The pattern primitive does not support string-literal
context awareness. A regex-based fix is not reliably possible in Lua 5.1
(no negative lookahead). Excluding via exclude_if_contains would be
fragile. Deferring -- no fix at this time.