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

Only filter by app & title keys by default #100

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iloveitaly
Copy link
Contributor

Matching against url, editor payload keys, etc could be problematic. The existing rules are written against these two fields, as far as I can tell.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented May 6, 2021

This pull request introduces 1 alert when merging 4206a8d into b11fbe0 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@@ -15,7 +15,7 @@ class Rule:
ignore_case: bool

def __init__(self, rules: Dict[str, Any]):
self.select_keys = rules.get("select_keys", None)
self.select_keys = rules.get("select_keys", ["app", "title"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as a default when creating a new rule in the frontend, not made an implicit default in the transform imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like there is an existing component we can use for a multiselect/array form input right now. Am I missing something?

Here's what I propose here:

  • Merge this PR to avoid accidental categorization (matching against url could yield bad results)
  • Having an explicit all magic key will be helpful regardless
  • Work on getting a array input + select_keys available on the frontend

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like there is an existing component we can use for a multiselect/array form input right now.

No, but should be easy to add. Could even just put a text field, and ask users to comma-separate.

aw_transform/classify.py Outdated Show resolved Hide resolved
@iloveitaly
Copy link
Contributor Author

@ErikBjare What do you think about updating the defaults of all existing rules with "select_keys":["app", "title"]? Agreed that it is more flexible to keep these defined on the frontend.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented May 13, 2021

This pull request introduces 1 alert when merging 876b32c into 5bd84b1 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@johan-bjareholt
Copy link
Member

What do you think about updating the defaults of all existing rules with "select_keys":["app", "title"]? Agreed that it is more flexible to keep these defined on the frontend.

If we added a way in the web-ui for the user to select the keys himself in a user-friendly way that would probably be OK for most rules. If it's a hidden configuration that the user can't change without exporting and then importing the rules again however I don't think it's a good idea to hide the behavior from the user.

@iloveitaly
Copy link
Contributor Author

Agreed, my assumption here is we would add this to the webui at some point soon.

In the meantime, I'm wondering if it makes sense to add defaults to each default rule as I believe these are written to only match against the app & title keys. Introducing more keys may cause categorization errors.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Jun 8, 2022

This pull request introduces 1 alert when merging cbdd792 into 8aaa353 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@iloveitaly
Copy link
Contributor Author

In the meantime, I'm wondering if it makes sense to add defaults to each default rule as I believe these are written to only match against the app & title keys. Introducing more keys may cause categorization errors.

@ErikBjare what do you think here?

Matching against url, editor payload keys, etc could be problematic. The existing rules are written against these two fields, as far as I can tell.
@ErikBjare
Copy link
Member

ErikBjare commented Jul 6, 2022

@iloveitaly Just keep the old behavior (server-side default to check all keys, undo beac24b), it's good enough for now.

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

Successfully merging this pull request may close these issues.

3 participants