feat(pattern): add skip_comments parameter to pattern primitive #9
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#9
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 pattern primitive matches all lines including comments.
This causes false positives when a pattern appears in a comment
as documentation or example output rather than actual code.
Example:
core/reporter.lualine 6 containsio.openin a comment(
-- [ERROR] src/foo.lua:42 -- io.open direkt aufgerufen) andtriggers the no-direct-io rule.
Solution
Add optional
skip_commentsparameter to the rule YAML (check section).The primitive filters comment lines before matching when enabled.
Rule example:
Default is
false-- existing rules are unaffected.Comment detection is language-specific; first implementation covers
Lua (
--prefix) and Shell (#prefix), based on file extension.Affected Files
var/modules/fragjan-check-pattern/init.lua-- skip_comments logicvar/rules/daw-code/rules/no-direct-io.yaml-- set skip_comments: trueNotes
skip_comments: false(default) keeps current behavior.Rules that intentionally scan comments (e.g. version strings,
annotations) simply omit the parameter or set it to false.
Language detection via file extension is sufficient for now;
a
comment_prefixoverride parameter can be added later if needed.