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

Refactor filtering function #12

Open
le91688 opened this issue Jun 21, 2023 · 0 comments
Open

Refactor filtering function #12

le91688 opened this issue Jun 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@le91688
Copy link
Contributor

le91688 commented Jun 21, 2023

Title: Improve Filtering Function and Add Support for Additional Operators

Description:

The filtering function in our application can be refactored for better understandability and extensibility. Currently, the logic is a bit hard to follow. By pulling out the filtering into a dedicated function, we could make the code easier to understand and maintain. In addition, we should add support for more operators to increase the versatility of our filtering.

Tasks:

  1. Refactor the current filtering code into a separate function, possibly with this signature:
    if all(matches(device, key) for key in criteria):
  2. Add support for the following operators:
    • ==, != for literal matches (strings, numeric types, bools)
    • >=, <=, >, < for comparison (strings (alphabetic), numeric)
    • =~ for regex matches (strings, numeric), borrowing the operator from bash
  3. Handle malformed regex that would be valid literal text i.e., text with an unpaired parenthesis.
  4. Replace re.match with re.search for more comprehensive string pattern searching.
  5. Test the new filtering function with various scenarios and edge cases.
  6. Update related documentation to reflect the new filtering functionality and supported operators.

Acceptance Criteria:

  • The filtering function is refactored into a separate, more understandable function.
  • The application successfully supports the additional operators.
  • The application correctly handles malformed regex.
  • The re.match function is replaced with re.search for more comprehensive string pattern searching.
  • The new functionality is validated and tested in different scenarios.
  • The documentation is updated to reflect the enhanced filtering functionality and added operators.
@le91688 le91688 changed the title [IMPROVEMENT] Refactor filtering function Refactor filtering function Jun 27, 2023
@le91688 le91688 added the enhancement New feature or request label Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant