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: Updated message-shim to remove cognitive complexity violations. #1958

Merged
merged 2 commits into from Jan 22, 2024

Conversation

bizob2828
Copy link
Member

Fixed jsdoc warnings as well.

Description

I refactored message-shim by extracting inline functions into top level scope. I also moved some of the helper functions into their own files. I fixed all the jsdoc violations and lastly added the MessageSpec and MessageSubscribeSpec into specs instead of inline within file.

How to Test

npm test

Related Issues

Closes NR-134575

violations.

 Fixed jsdoc warnings as well.
Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (e156539) 97.03% compared to head (52cecf3) 97.04%.

Files Patch % Lines
lib/shim/message-shim/subscribe-consume.js 95.30% 10 Missing ⚠️
lib/shim/message-shim/consume.js 96.40% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1958   +/-   ##
=======================================
  Coverage   97.03%   97.04%           
=======================================
  Files         215      218    +3     
  Lines       40372    40450   +78     
=======================================
+ Hits        39176    39254   +78     
  Misses       1196     1196           
Flag Coverage Δ
integration-tests-16.x 78.90% <35.08%> (+<0.01%) ⬆️
integration-tests-18.x 79.16% <35.08%> (+0.01%) ⬆️
integration-tests-20.x 79.16% <35.08%> (-0.01%) ⬇️
unit-tests-16.x 91.14% <96.49%> (+0.01%) ⬆️
unit-tests-18.x 91.12% <96.49%> (+0.01%) ⬆️
unit-tests-20.x 91.12% <96.49%> (+0.01%) ⬆️
versioned-tests-16.x 74.07% <92.98%> (+0.04%) ⬆️
versioned-tests-18.x 74.09% <92.98%> (+0.04%) ⬆️
versioned-tests-20.x 74.10% <92.98%> (+0.04%) ⬆️

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.

jsumners-nr
jsumners-nr previously approved these changes Jan 22, 2024
* @param {boolean} params.destNameIsArg flag to state if destination is an argument
* @returns {Function} wrapped subscribe function
*/
module.exports = function createSubscriberWrapper({ shim, fn, spec, destNameIsArg }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would refactor this to module.exports = createSubscriberWrapper at the top of the file. It makes it easier to see what the export is, where as the current declaration is easy to overlook.

@bizob2828
Copy link
Member Author

confirmed the missing coverage existed before just calls it out because code was moved

@bizob2828 bizob2828 merged commit 3d1caaf into newrelic:main Jan 22, 2024
21 of 22 checks passed
Node.js Engineering Board automation moved this from Needs PR Review to Done: Issues recently completed Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Node.js Engineering Board
  
Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants