AdguardTeam / AdguardTeam/AGLint

Add linter rule for detecting unnecessary wildcards in network rule patterns

Ouverte
#263 0 commentaires 1 réaction 1 personne assignée Réclamée par @maximtop Voir sur GitHub
Priority: P4 T: Linter rule
Langage dominant
TypeScript
Étoiles
70
Forks
4
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

In network rule patterns, the wildcard is used to match any sequence of characters.
However, there are three redundant cases that should be flagged:

- Duplicated wildcards (2 or more), e.g. `foo**bar` or `foo***bar`
- Leading wildcard, e.g. `*pattern` or multiple, like `**pattern`
- Trailing wildcard, e.g. `pattern*` or multiple, like `pattern**`

Note: in some cases we should allow a trailing wildcard. For example, if the user wants to avoid `/foo/bar/` being interpreted as a regular expression, they may write `/foo/bar/*` instead. See https://github.com/AdguardTeam/AGLint/issues/264

The problem should be autofixable.

It is important that redundant wildcards do not cause any functional issues, so marking this as a warning is sufficient, and it does not need to be part of the network rule pattern validator.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.