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

[WIP] policy: refactor of policy options and matching #1192

Closed
wants to merge 2 commits into from

Conversation

wihobbs
Copy link
Member

@wihobbs wihobbs commented Apr 30, 2024

Problem: the current matching functions for config-provided policies don't take advantage of some C++20 features, are a bit confusing, and have no unit tests.

Refactor and add unit testing.

Problem: the current matching functions for config-provided policies
don't take advantage of some C++20 features, are a bit confusing,
and have no unit tests.

Refactor and add unit testing.
matcher = std::make_shared<greater_interval_first_t> ();
} else if (policy == VAR_AWARE) {
} else if (policy == "VAR_AWARE") {
Copy link
Member

@jameshcorbett jameshcorbett May 1, 2024

Choose a reason for hiding this comment

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

I think it's usually discouraged to have lots of string literals lying around. The more times you type out the string, the greater the chance that you'll mistype it once and it can sometimes be pretty annoying to debug. If you refer to the string using a variable (like VAR_AWARE here), at least the compiler will tell you if you mistype the name. So in this switchyard I would probably go for something like if policy == policies["firstnodex"] rather than if policy == "FIRST_NODEX_MATCH".

Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.9%. Comparing base (bb686df) to head (053c0a5).
Report is 62 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1192     +/-   ##
========================================
- Coverage    73.9%   73.9%   -0.1%     
========================================
  Files         102     103      +1     
  Lines       14565   14576     +11     
========================================
+ Hits        10766   10773      +7     
- Misses       3799    3803      +4     

see 2 files with indirect coverage changes

@wihobbs
Copy link
Member Author

wihobbs commented Jun 12, 2024

Oh, oops, I had forgotten this was open as a PR. Ignore that push, that was just to sync across machines.

@wihobbs wihobbs closed this Jul 9, 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.

None yet

2 participants