Skip to content

Conversation

@Brajk19
Copy link
Member

@Brajk19 Brajk19 commented Apr 14, 2025

Currently, we are using str_replace for generating inverse PurgeOn::if expressions. This can lead to invalid expressions if e.g. method name contains obj ('obj.getobj()').

To avoid this, expression syntax tree is traversed so we can correctly detect where obj is called.

@Brajk19 Brajk19 requested a review from HypeMC April 14, 2025 18:34
@Brajk19 Brajk19 self-assigned this Apr 14, 2025
@codecov
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.08%. Comparing base (a6b2da8) to head (9d58401).

Additional details and impacted files
@@             Coverage Diff              @@
##                1.x     #102      +/-   ##
============================================
+ Coverage     96.97%   97.08%   +0.10%     
- Complexity      491      496       +5     
============================================
  Files            62       62              
  Lines          1454     1474      +20     
============================================
+ Hits           1410     1431      +21     
+ Misses           44       43       -1     
Flag Coverage Δ
8.1 97.08% <100.00%> (+0.10%) ⬆️
8.2 97.01% <100.00%> (+0.11%) ⬆️
8.3 97.01% <100.00%> (+0.11%) ⬆️
8.4 97.01% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

],
],
'if' => "obj.owner !== null && (obj.owner.firstName === 'John')",
'if' => 'obj.owner !== null && ((obj.owner.firstName === "John"))',
Copy link
Member Author

Choose a reason for hiding this comment

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

when converting some types of nodes to string, they are wrapped in parentheses so we end up with double parentheses.
not sure if we should handle this or just leave it be.

@Brajk19 Brajk19 force-pushed the inverse-if-expression branch from 940fe49 to 9d58401 Compare April 28, 2025 09:04
@HypeMC HypeMC changed the base branch from 1.x to 2.x December 15, 2025 19:18
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.

1 participant