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

[Ellipsis] Improve Regex Error Handling and Code Cleanup #102

Closed
wants to merge 6 commits into from

Conversation

ellipsis-dev[bot]
Copy link

@ellipsis-dev ellipsis-dev bot commented May 8, 2024

This change addresses review comments left by @ErikBjare on PR #99: [Feature] Add exclude_titles feature for enhanced window title exclusion

Summary:

Enhanced regex error handling in heartbeat_loop and cleaned up code in /aw_watcher_window/main.py.

Key points:

  • Updated heartbeat_loop in /aw_watcher_window/main.py to handle regex errors.
  • Added try-except block for regex compilation in list comprehension.
  • Removed unnecessary whitespace and comments for cleaner code.

You can configure Ellipsis to address comments with a direct commit or a side PR, see docs.


Something look wrong?: If this Pull Request doesn't address the comments left on the above pull request, create a new PR review with more details. For more information, check the documentation.

Generated with ❤️ by ellipsis.dev

0xErwin1 and others added 6 commits February 4, 2024 09:49
This commit introduces the `--exclude-titles` argument to the aw-watcher-window module,
allowing users to specify a list of window titles or regular expression patterns to exclude from tracking.
This new feature is designed to complement the existing `--exclude-title` flag,
providing enhanced flexibility for users who need to exclude multiple window titles
without breaking compatibility with existing configurations.

Key Changes:
- Added the `--exclude-titles` argument to the argparse configuration in `config.py`, enabling the specification of multiple exclusion patterns.
- Updated the `heartbeat_loop` function in `main.py` to support both `exclude_title` and `exclude_titles`, with `exclude_titles` allowing for an array of titles to be excluded.
- Utilized the `re` module for regex pattern matching against window titles, ensuring case-insensitive comparisons.

This enhancement ensures that users can now more precisely control which window titles are excluded from tracking,
making the aw-watcher-window module more versatile and user-friendly.
Co-authored-by: Erik Bjäreholt <[email protected]>
…tles` feature for enhanced window title exclusion);
@@ -92,10 +91,10 @@
poll_time=args.poll_time,
strategy=args.strategy,
exclude_title=args.exclude_title,
exclude_titles=[try: re.compile(title, re.IGNORECASE) except re.error: re.compile(re.escape(title), re.IGNORECASE) for title in args.exclude_titles]

Check failure

Code scanning / CodeQL

Syntax error Error

Syntax Error (in Python 3).
Copy link
Member

Choose a reason for hiding this comment

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

lol, Ellipsis really butchered this.

Choose a reason for hiding this comment

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

hey @ErikBjare , looking into what happened here...

Choose a reason for hiding this comment

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

@ErikBjare you can get much higher quality out of Ellipsis by adding a Dockerfile and build/test commands so that it can verify its changes - see docs here https://docs.ellipsis.dev/build. We have a playground as well where you can test it out at https://app.ellipsis.dev/

Choose a reason for hiding this comment

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

happy to help get you onboarded to that 🙏

@ErikBjare ErikBjare closed this May 8, 2024
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