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

Fix bug related to empty package manager name in npm_and_yarn package manager #10936

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

kbukum1
Copy link
Contributor

@kbukum1 kbukum1 commented Nov 14, 2024

What are you trying to accomplish?

This PR fixes a bug in the npm_and_yarn/package_manager.rb file where an empty or undefined package manager name resulted in a NoMethodError (undefined method 'to_sym' for an instance of Hash). This error, as reported in Sentry Issue DELTAFORCE-11XD, occurred when package_manager_by_name was called with an invalid package manager name.

The update ensures that the method handles cases of empty or invalid package manager names gracefully, preventing to_sym from being called on unintended data types.

Anything you want to highlight for special attention from reviewers?

To resolve this issue, the code now checks the validity of the package manager name before calling to_sym. Reviewers should focus on the additional validation logic to confirm that it aligns with expected behavior for handling empty or missing package manager names.

How will you know you've accomplished your goal?

  • Reproduction: The bug has been reproduced, and the fix prevents the error when an empty package manager name is used.
  • Feature Validation: Tests have been added for cases where the package manager name is empty or invalid to ensure consistent behavior.

Checklist

  • Complete test suite executed, ensuring all tests and linters pass.
  • Additional tests added to cover scenarios with empty or invalid package manager names.
  • Commit messages are clear and descriptive.
  • Provided a detailed description, including the problem, solution, and relevant implementation details.
  • Ensured the code is well-documented and easy to understand.

@kbukum1 kbukum1 marked this pull request as ready for review November 14, 2024 02:35
@kbukum1 kbukum1 requested a review from a team as a code owner November 14, 2024 02:35
@kbukum1 kbukum1 merged commit 03f1816 into main Nov 14, 2024
66 checks passed
@kbukum1 kbukum1 deleted the kamil/fix_bug_related_to_empty_package_manager_name branch November 14, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants