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

chore: refactor complex implementation of request-processing filters #1333

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

samayer12
Copy link
Collaborator

Description

This PR is part of the effort to reduce complexity in the code. Instead of using ternaries that are chained together, this refactor introduces a FilterChain analagous to what you might see in the Spring Framework to achieve the same outcome, improving readability and maintenance.

Related Issue

Relates to #1248

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

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

Project coverage is 86.37%. Comparing base (7260348) to head (4c4158b).

Files with missing lines Patch % Lines
src/lib/filter/filtersWithLogs.ts 98.68% 1 Missing ⚠️
src/lib/filter/logMessages.ts 95.65% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1333      +/-   ##
==========================================
+ Coverage   85.64%   86.37%   +0.73%     
==========================================
  Files          31       34       +3     
  Lines        1449     1527      +78     
  Branches      319      309      -10     
==========================================
+ Hits         1241     1319      +78     
+ Misses        206      190      -16     
- Partials        2       18      +16     
Files with missing lines Coverage Δ
src/lib/filter/adjudicators.ts 100.00% <100.00%> (ø)
src/lib/filter/filterChain.ts 100.00% <100.00%> (ø)
src/lib/filter/shouldSkipRequest.ts 100.00% <100.00%> (ø)
src/lib/helpers.ts 97.19% <ø> (ø)
src/lib/types.ts 100.00% <ø> (ø)
src/lib/filter/filtersWithLogs.ts 98.68% <98.68%> (ø)
src/lib/filter/logMessages.ts 95.65% <95.65%> (ø)

... and 4 files with indirect coverage changes

@samayer12 samayer12 force-pushed the 1248-refactor-complexity-warnings branch from e0c61c8 to 9385b6d Compare October 25, 2024 21:19
@samayer12 samayer12 marked this pull request as ready for review October 25, 2024 21:20
@samayer12 samayer12 requested a review from a team as a code owner October 25, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant