You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The packages/parameters package contains 9 code quality issues identified by SonarQube that affect parameter retrieval functionality and test reliability:
Readonly Member Issues (4 MAJOR issues): Class members that are never reassigned after initialization but are not marked as readonly
Type Safety: Prevents accidental reassignment of critical configuration members
Import Optimization: Reduces bundle size and improves build performance
Developer Intent: Makes the immutable nature of these members explicit to future maintainers
Best Practices: Follows TypeScript best practices for class member declarations and imports
The Parameters package is a foundational utility for retrieving configuration from AWS services like SSM, Secrets Manager, and AppConfig, so maintaining high code quality standards here is particularly important for reliability.
Solution
Important
The following changes are included as reference to help you understand the refactoring. Before implementing, please make sure to check the codebase and ensure that they make sense and they are exhaustive.
1. Fix AppConfigProvider.ts readonly members (2 issues)
Run npm run test:unit -w packages/parameters to ensure no regressions
Run npm run lint -w packages/parameters to verify code style compliance
Run npm run build -ws to verify TypeScript compilation
Run SonarQube analysis to confirm issues are resolved
Additional Context
This issue was identified as part of a SonarQube code quality review. The Parameters package is a foundational utility for retrieving configuration from AWS services like SSM Parameter Store, AWS Secrets Manager, and AWS AppConfig, making code quality improvements here particularly valuable for reliability and maintainability.
These changes are primarily declarative improvements that should not change any functionality or behavior - they simply make the immutable nature of class members explicit and optimize imports.
Summary
The
packages/parameterspackage contains 9 code quality issues identified by SonarQube that affect parameter retrieval functionality and test reliability:Readonly Member Issues (4 MAJOR issues): Class members that are never reassigned after initialization but are not marked as
readonlypackages/parameters/src/appconfig/AppConfigProvider.ts(2 members: lines 192, 193)packages/parameters/tests/unit/BaseProvider.test.ts(1 member: line 27)packages/parameters/tests/helpers/tinyLogger.ts(1 member: line 16)Import Issues (2 MINOR issues): Duplicate imports that can be consolidated
packages/parameters/src/dynamodb/DynamoDBProvider.ts(lines 5, 11)Union Type Issues (1 MINOR issue): Type union optimization needed
packages/parameters/src/base/BaseProvider.ts(line 95)Test Code Issues (2 MINOR issues): Unnecessary type assertions in tests
packages/parameters/tests/unit/SSMProvider.test.ts(lines 1015, 1235)These issues affect core parameter providers, base functionality, and test reliability across the Parameters package.
Why is this needed?
The Parameters package is a foundational utility for retrieving configuration from AWS services like SSM, Secrets Manager, and AppConfig, so maintaining high code quality standards here is particularly important for reliability.
Solution
Important
The following changes are included as reference to help you understand the refactoring. Before implementing, please make sure to check the codebase and ensure that they make sense and they are exhaustive.
1. Fix AppConfigProvider.ts readonly members (2 issues)
Current code:
Improved code:
2. Fix BaseProvider.test.ts readonly member (1 issue)
Current code:
Improved code:
3. Fix tinyLogger.ts readonly member (1 issue)
Current code:
Improved code:
4. Fix DynamoDBProvider.ts duplicate imports (2 issues)
Current code:
Improved code:
5. Fix BaseProvider.ts union type (1 issue)
Current code:
Improved code:
6. Fix SSMProvider.test.ts unnecessary assertions (2 issues)
Current code:
Improved code:
These changes:
Implementation Details
Files to modify:
packages/parameters/src/appconfig/AppConfigProvider.ts(lines 192, 193)packages/parameters/tests/unit/BaseProvider.test.ts(line 27)packages/parameters/tests/helpers/tinyLogger.ts(line 16)packages/parameters/src/dynamodb/DynamoDBProvider.ts(lines 5, 11)packages/parameters/src/base/BaseProvider.ts(line 95)packages/parameters/tests/unit/SSMProvider.test.ts(lines 1015, 1235)Testing:
Validation:
npm run test:unit -w packages/parametersto ensure no regressionsnpm run lint -w packages/parametersto verify code style compliancenpm run build -wsto verify TypeScript compilationAdditional Context
This issue was identified as part of a SonarQube code quality review. The Parameters package is a foundational utility for retrieving configuration from AWS services like SSM Parameter Store, AWS Secrets Manager, and AWS AppConfig, making code quality improvements here particularly valuable for reliability and maintainability.
These changes are primarily declarative improvements that should not change any functionality or behavior - they simply make the immutable nature of class members explicit and optimize imports.
SonarQube Issue Keys:
AZItlgSpcEUs2753LD6M- AppConfigProvider.ts applicationAZItlgSpcEUs2753LD6N- AppConfigProvider.ts environmentAZItlgUBcEUs2753LD6O- BaseProvider.test.ts #nameAZItlgVTcEUs2753LD6P- tinyLogger.ts consoleAY1fFCoNqFe1DseJcRV6- DynamoDBProvider.ts duplicate import (line 5)AY1fFCoNqFe1DseJcRV7- DynamoDBProvider.ts duplicate import (line 11)AYlpRzOxOvI06ztqLT9P- BaseProvider.ts union typeAY99NK8Sr_nD7WwQSUhP- SSMProvider.test.ts unnecessary assertion (line 1015)AY99NK8Sr_nD7WwQSUhQ- SSMProvider.test.ts unnecessary assertion (line 1235)Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.