Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new rule to blacklist rules #214

Closed
Yuki2718 opened this issue Aug 23, 2024 · 4 comments
Closed

Add a new rule to blacklist rules #214

Yuki2718 opened this issue Aug 23, 2024 · 4 comments

Comments

@Yuki2718
Copy link

Yuki2718 commented Aug 23, 2024

There have been cases a problematic rule was removed and then readded, causing the trouble again. A recent example is AdguardTeam/AdguardFilters@dea5d96 but there were many more. I knew the rule would be readded, hence left a comment but it didn't prevent. While other repos such as EL also suffer this sort of issue, it tends to happen on AG more as the number of people working is the largest with some members not being aware of removel of the problematic rule. Adding a blacklist to check before commit will mitigate the problem, e.g. register staff-start.com/js/track/ and any rule including staff-start.com/js/track/ will be warned.

@Yuki2718
Copy link
Author

FWIW a similar case in EL:
||static.lefigaro.fr/figconsent/ was removed for easylist/easylist#16487 and then readded by easylist/easylist#18154 , caused uBlockOrigin/uAssets#25030 (reply in thread)

@scripthunter7
Copy link
Member

scripthunter7 commented Sep 2, 2024

There are two options here:

  • one is to accept the regexps and blacklist all rules that match these regexps, and
  • blacklist the exact rule texts

@scripthunter7 scripthunter7 changed the title Add blacklist of rules Add a new rule to blacklist rules Sep 2, 2024
@scripthunter7 scripthunter7 added the T: Linter rule Linter rule related label Sep 2, 2024
@Yuki2718
Copy link
Author

Yuki2718 commented Sep 2, 2024

  • one is to accept the regexps and blacklist all rules that match these regexps, and

This will be preferred. My idea is that like :contains() plaintext string matches any rules which include the string and regex for more complex cases (e.g. blacklisting only a generic hiding rule and not its specific form). I think the exclusion in FiltersRegistry works in this way?

@scripthunter7
Copy link
Member

scripthunter7 commented Sep 2, 2024

@Yuki2718 i mean, we can add both)

We can specify the config like this (.aglintrc.yaml)

root: true
extends:
  - aglint:recommended
syntax:
  - AdGuard
rules:
  no-excluded-rules:
    # exclude all rules that match at least one pattern from here
    exclude-patterns:
      - /regex/
    # exclude all rules listed here (character correct match)
    exclude-rules:
      - '||example.com/donotblock.css'
      - '/donotblock.js'

btw, we can extend this with exclude-domains, etc. if ever needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants