Skip to content

Add linter rule for detecting useless filter anchors at start/end of network rule patterns #265

@scripthunter7

Description

@scripthunter7

Certain network filter patterns contain meaningless or redundant anchors that do not affect matching and should be removed. Two cases should be detected:

1. Useless filter start

Patterns starting with |*, e.g.:

|*foo

This combination is semantically useless (| anchors to the start, * matches anything).

2. Useless filter end

Patterns ending with sequences like:

foo*^
foo*|
foo*^|
foo*^^|
*|
***^

These endings provide no meaningful restriction and are effectively redundant.

We should introduce a linter rule that:

  • detects useless start/end constructs
  • reports them as warnings,
  • provides autofix by removing the redundant part of the pattern.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions