Skip to content

chore(parameters): fix SonarQube code quality issues and optimize imports #4359

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

Conversation

shrivarshapoojari
Copy link
Contributor

Summary

This pull request addresses and resolves all 9 SonarQube code quality issues identified in the packages/parameters package, as detailed in issue #4256. These improvements enhance maintainability, enforce immutability where intended, optimize imports, and clean up test code for clarity and reliability.

Changes

1. Immutability with readonly Members

  • AppConfigProvider.ts
    • Marked application and environment as readonly (lines 192, 193), making their immutability explicit.
  • BaseProvider.test.ts
    • Set the private class field #name as readonly (line 27).
  • tinyLogger.ts
    • Marked the console property as readonly (line 16).

2. Import Optimization

  • DynamoDBProvider.ts
    • Consolidated duplicate imports from @aws-sdk/client-dynamodb into a single import statement (lines 5, 11).

3. Union Type Improvement

  • BaseProvider.ts
    • Refined the return type of get method to remove unnecessary undefined from the union (line 95), improving type safety and API clarity.

4. Test Cleanup

  • SSMProvider.ts

    • Removed two unnecessary type assertions (lines 1015, 1235) to improve test code readability and reliability.
  • SSMProvider.test.ts

    • Updated response field type from GetParametersCommandOutput to Partial (lines 824,923)

Issue number: closes #4256


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Copy link

boring-cyborg bot commented Aug 19, 2025

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/S PR between 10-29 LOC label Aug 19, 2025
@boring-cyborg boring-cyborg bot added parameters This item relates to the Parameters Utility tests PRs that add or change tests labels Aug 19, 2025
Copy link

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you for contributing this PR and congrats for your first merged PR in this project!

If you're interested in picking up any other issue, we have many of similar complexity/effort.

@dreamorosi dreamorosi merged commit 59a191d into aws-powertools:main Aug 19, 2025
34 checks passed
Copy link

boring-cyborg bot commented Aug 19, 2025

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Copy link
Contributor

@sdangol sdangol left a comment

Choose a reason for hiding this comment

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

Nice! Looks good. Thanks for the PR

@shrivarshapoojari
Copy link
Contributor Author

Thank you so much for your support and guidance..
Looking forward for more contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parameters This item relates to the Parameters Utility size/S PR between 10-29 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: Fix code quality issues in parameters package
3 participants