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

Refactor filtering rules #246

Open
scripthunter7 opened this issue Jan 28, 2022 · 5 comments
Open

Refactor filtering rules #246

scripthunter7 opened this issue Jan 28, 2022 · 5 comments

Comments

@scripthunter7
Copy link
Member

scripthunter7 commented Jan 28, 2022

Since I took over the maintenance of the filter list, I've made many optimizations on it, but I think that there are still many filtering rules that should be improved. This issue focuses on solving this problem.

Goals:

  • Remove rules for dead websites
  • Remove outdated rules (if the website is still alive, but the filtering rule no longer works on it)
  • Wherever possible, the *= and ^= attribute selectors should be reduced/replaced by a more optimal solution
    • Current stat:
      • ~490 search results for *=
      • ~90 search results for ^=
      • ~160 search results for *="banner"
      • ~50 search results for *="hirdetes"

In my opinion, the ideal scenario in the first round is to do a refactoring on each main website first, which consists of the following steps:

  1. Visit the website with hufilter turned off in your adblocker
  2. Collecting the actual filtering rules required for the website as user rules. If the website redirects to a dead or different domain, the rules should be deleted or the domain should be updated
  3. Open a PR for that website with branch name fix/246/xy.hu where 246 refers to this issue and xy.hu to the corresponding website's address. Such a PR will probably affect several section files at the same time, but this is not a problem

Some general principles:

  • The CSS selectors should be as "optimal" as possible, e.g. if it's possible to specify #id selector, avoid the [id="id"] attribute selector, try to avoid nth-child, etc.
  • We prefer single selectors, so instead of ##.selector1, .selector2 please always use ##.selector1 and ##.selector2
  • The rule should be prepared in such a way that if the structure of the website changes in the future, it will cause breakage on the page with the smallest possible chance
  • Use Extended CSS only in justified cases

Any help is greatly appreciated! I think even some PR can be a big help if someone has the free time to do it. It's enough to take small steps, we don't have to do it all at once. 🙂

@scripthunter7 scripthunter7 linked a pull request Jan 28, 2022 that will close this issue
@scripthunter7 scripthunter7 removed a link to a pull request Jan 28, 2022
@scripthunter7 scripthunter7 added this to the Improve hufilter quality milestone Jun 1, 2022
@scripthunter7 scripthunter7 self-assigned this Jun 1, 2022
@scripthunter7
Copy link
Member Author

scripthunter7 commented Jun 30, 2023

@ehrhardt06 I see you've submitted some pretty good PRs so far, thank you :) Are you interested in this? Basically, the goal is to refactor the current rules. I think there may be several old or outdated rules in our filter.

I also plan to open some PRs following this scenario as my free time allows.

Note: I prefer English communication where possible, as other filter maintainers probably don't understand Hungarian :)

@scripthunter7 scripthunter7 changed the title Optimization, reduce *=, ^= selectors Refactor filtering rules Jun 30, 2023
@ehrhardt06
Copy link
Collaborator

@scripthunter7 Sure, I'm happy to help. I'm quite a beginner in coding (it's far from being what I do, it's just a hobby for me) and I'm going to be quite busy in the coming weeks. So I will be slow, but I will try to open some new PRs over time.

I prefer English communication where possible, as other filter maintainers probably don't understand Hungarian :)

gotcha :)

@scripthunter7
Copy link
Member Author

Thank you! 🙂 Please keep in mind that this is an epic issue, you don't have to solve everything, it's a long process. If you can help with just a few PRs by solving tasks that are close to you, it's already a huge help :) If you need help with anything, feel free to tag me in your PRs / comments.

@scripthunter7 scripthunter7 pinned this issue Jun 30, 2023
This was referenced Jul 1, 2023
@scripthunter7 scripthunter7 removed this from the Improve hufilter quality milestone Jul 1, 2023
@scripthunter7 scripthunter7 mentioned this issue Jul 2, 2023
This was referenced Jul 3, 2023
@ehrhardt06 ehrhardt06 mentioned this issue Jul 22, 2023
@scripthunter7
Copy link
Member Author

@ehrhardt06 I think at this point we should focus on dead websites, especially those with a non-hu TLD

@ehrhardt06
Copy link
Collaborator

@scripthunter7 sure thing

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

2 participants