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

feat: enhance add_filter to support the max matched lines #4303

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

Conversation

xiangce
Copy link
Contributor

@xiangce xiangce commented Dec 12, 2024

  • Added a new keyword argument "max_match=MAX_MATCH" to add_filter.
    By declaring the max_match, at most max_match number of lines that
    contain the patterns will be filtered out in the collection.
    For redundant declarations the maximum max_match will be kept as the
    final scanning number. If no max_match is declared when add_filter,
    the filters.MAX_MATCH (=10000) will be take as the default value.
  • Added a new keyword argument "with_matches=False" to the get_filters.
    When "with_matches=True" is specified, the return value of the
    get_filters will be dict in which the max scanning numbers for each
    filter pattern are included as the dict value.
  • update the exiting tests
  • RHINENG-14669

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • No Sensitive Data in this change?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

Add your description here

- RHINENG-14668
  for each filter, keep 10k matched lines by default for now.
  don't remove the "grep -F" as it's faster and can be used
  to reduce the file size before cleaning
- Add test to verify the count of matched lines
  Move all spec relevant tests to tests/specs
  Move all core relevant tests to tests/core

Signed-off-by: Xiangce Liu <[email protected]>
- added a new keyword argument "max_match=MAX_MATCH" to `add_filter`.
  By declaring the max_match, at most `max_match` number of lines that
  contain the patterns will be filtered out in the collection.
  For redundant declarations the maximum `max_match` will be kept as the
  final scanning number.  If no `max_match` is declared when `add_filter`,
  the filters.MAX_MATCH (=10000) will be take as the default value.
- added a new keyword argument "with_matches=False" to the `get_filters`.
  When "with_matches=True" is specified, the return value of the
  `get_filters` will be dict in which the max scanning numbers for each
  filter pattern are included as the dict value.
- update the exiting tests
- RHINENG-14669

Signed-off-by: Xiangce Liu <[email protected]>
@xiangce
Copy link
Contributor Author

xiangce commented Dec 12, 2024

It depends on #4299. Please do not review it yet.

@codecov-commenter
Copy link

codecov-commenter commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 93.05556% with 5 lines in your changes missing coverage. Please review.

Project coverage is 77.20%. Comparing base (08fd76a) to head (6983165).

Files with missing lines Patch % Lines
insights/core/spec_cleaner.py 86.95% 1 Missing and 2 partials ⚠️
insights/core/filters.py 96.42% 1 Missing ⚠️
insights/core/spec_factory.py 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4303      +/-   ##
==========================================
+ Coverage   77.18%   77.20%   +0.02%     
==========================================
  Files         767      767              
  Lines       41762    41787      +25     
  Branches     8818     8827       +9     
==========================================
+ Hits        32232    32262      +30     
+ Misses       8462     8455       -7     
- Partials     1068     1070       +2     
Flag Coverage Δ
unittests 77.19% <93.05%> (+0.02%) ⬆️

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.

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.

2 participants