Skip to content

fix: handle ^ and $ in rules#684

Merged
ErikBjare merged 1 commit intoActivityWatch:masterfrom
istudyatuni:push-ymqtklzzlltx
Jun 2, 2025
Merged

fix: handle ^ and $ in rules#684
ErikBjare merged 1 commit intoActivityWatch:masterfrom
istudyatuni:push-ymqtklzzlltx

Conversation

@istudyatuni
Copy link
Copy Markdown
Contributor

@istudyatuni istudyatuni commented May 31, 2025

Fix ActivityWatch/activitywatch#1148


Important

Fixes handling of ^ and $ in regex rules by adding 'm' flag and adjusting string concatenation in classes.ts and color.ts.

  • Behavior:
    • Fixes handling of ^ and $ in regex rules by adding 'm' flag in matchString in classes.ts and getCategoryColorFromEvent in color.ts.
    • Concatenates app and title with line breaks in getCategoryColorFromEvent for currentwindow and web.tab.current buckets.
  • Misc:
    • Adds comment in classifyEvents in classes.ts indicating it's used only in tests.

This description was created by Ellipsis for b4f5060. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to b4f5060 in 1 minute and 7 seconds. Click for details.
  • Reviewed 42 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/util/classes.ts:218
  • Draft comment:
    Good improvement: appending the 'm' flag ensures '^' and '$' work as intended. For consistency, consider if regexes in other parts (e.g. in tests) should also use the same flag.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. src/util/color.ts:133
  • Draft comment:
    Using a newline separator (\n) ensures multiline matching with '^' and '$'. Ensure this change doesn't affect any logic that relied on a space separator.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_6IefkUsCQp6AqF1w

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 26.30%. Comparing base (ca6fafd) to head (b4f5060).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/util/color.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #684   +/-   ##
=======================================
  Coverage   26.30%   26.30%           
=======================================
  Files          29       29           
  Lines        1684     1684           
  Branches      296      288    -8     
=======================================
  Hits          443      443           
- Misses       1180     1219   +39     
+ Partials       61       22   -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@BelKed BelKed left a comment

Choose a reason for hiding this comment

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

Nice and clever solution 🔥

Copy link
Copy Markdown
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

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

Nice and simple, thanks!

@ErikBjare ErikBjare merged commit 34b42ed into ActivityWatch:master Jun 2, 2025
8 checks passed
@istudyatuni istudyatuni deleted the push-ymqtklzzlltx branch June 2, 2025 17:25
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.

Regex with ^ doesn't work for title key

3 participants