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: resolve eslint warnings (max-depth, complexity) - src/lib/mutate-processor.ts #1543

Merged
merged 23 commits into from
Dec 12, 2024

Conversation

btlghrants
Copy link
Collaborator

Describe what should be investigated or refactored

Refactor of src/lib/mutate-processor.ts to reduce complexity warnings:

/pepr/src/lib/mutate-processor.ts
  18:8  warning  Async function 'mutateProcessor' has a complexity of 18. Maximum allowed is 10        complexity
  18:8  warning  Async function 'mutateProcessor' has too many statements (49). Maximum allowed is 20  max-statements
  99:9  warning  Blocks are nested too deeply (4). Maximum allowed is 3                                max-depth

Additional context

Fixes #1532
In support of #1248

@btlghrants btlghrants self-assigned this Dec 9, 2024
@btlghrants btlghrants added this to the v0.43.0 milestone Dec 9, 2024
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 20 lines in your changes missing coverage. Please review.

Project coverage is 80.28%. Comparing base (46c8514) to head (c99dfbc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/mutate-processor.ts 71.42% 17 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1543      +/-   ##
==========================================
+ Coverage   78.24%   80.28%   +2.04%     
==========================================
  Files          41       41              
  Lines        1889     1902      +13     
  Branches      444      436       -8     
==========================================
+ Hits         1478     1527      +49     
+ Misses        409      346      -63     
- Partials        2       29      +27     
Files with missing lines Coverage Δ
src/lib/mutate-processor.ts 62.63% <71.42%> (+52.38%) ⬆️

... and 7 files with indirect coverage changes

@btlghrants btlghrants marked this pull request as ready for review December 12, 2024 17:52
@btlghrants btlghrants requested a review from a team as a code owner December 12, 2024 17:52
@btlghrants
Copy link
Collaborator Author

Was able to squash the complexity and max-depth warnings but was only able to reduce the max-statements down to 25 (from 49); going any lower on the max-statements will have undesirable consequences on the cohesiveness of this method, IMO, so I added an eslint comment to extend the upper limit appropriately.

@samayer12
Copy link
Collaborator

Related to #1547

Copy link
Collaborator

@samayer12 samayer12 left a comment

Choose a reason for hiding this comment

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

We did a sync review of changes, good to go.

@cmwylie19 cmwylie19 added this pull request to the merge queue Dec 12, 2024
Merged via the queue into main with commit 6729370 Dec 12, 2024
47 of 48 checks passed
@cmwylie19 cmwylie19 deleted the 1532_complexity_mutate_processor branch December 12, 2024 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Complexity of mutate-processor
3 participants