Similar blocks of code found in 2 locations. Consider refactoring. Open
const (
SigningAlgorithmSpecRsassaPssSha256 SigningAlgorithmSpec = SigningAlgorithmSpec(SDK.SigningAlgorithmSpecRsassaPssSha256)
SigningAlgorithmSpecRsassaPssSha384 SigningAlgorithmSpec = SigningAlgorithmSpec(SDK.SigningAlgorithmSpecRsassaPssSha384)
SigningAlgorithmSpecRsassaPssSha512 SigningAlgorithmSpec = SigningAlgorithmSpec(SDK.SigningAlgorithmSpecRsassaPssSha512)
SigningAlgorithmSpecRsassaPkcs1V15Sha256 SigningAlgorithmSpec = SigningAlgorithmSpec(SDK.SigningAlgorithmSpecRsassaPkcs1V15Sha256)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 137.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
exported type KeyManagerType should have comment or be unexported Open
type KeyManagerType string
- Exclude checks
exported type CustomerMasterKeySpec should have comment or be unexported Open
type CustomerMasterKeySpec string
- Exclude checks
exported type KeyState should have comment or be unexported Open
type KeyState string
- Exclude checks
exported const EncryptionAlgorithmSpecSymmetricDefault should have comment (or a comment on this block) or be unexported Open
EncryptionAlgorithmSpecSymmetricDefault EncryptionAlgorithmSpec = EncryptionAlgorithmSpec(SDK.EncryptionAlgorithmSpecSymmetricDefault)
- Exclude checks
exported type EncryptionAlgorithmSpec should have comment or be unexported Open
type EncryptionAlgorithmSpec string
- Exclude checks
exported type KeyUsageType should have comment or be unexported Open
type KeyUsageType string
- Exclude checks
exported const ExpirationModelTypeKeyMaterialExpires should have comment (or a comment on this block) or be unexported Open
ExpirationModelTypeKeyMaterialExpires ExpirationModelType = ExpirationModelType(SDK.ExpirationModelTypeKeyMaterialExpires)
- Exclude checks
exported const SigningAlgorithmSpecRsassaPssSha256 should have comment (or a comment on this block) or be unexported Open
SigningAlgorithmSpecRsassaPssSha256 SigningAlgorithmSpec = SigningAlgorithmSpec(SDK.SigningAlgorithmSpecRsassaPssSha256)
- Exclude checks
exported const KeyStateEnabled should have comment (or a comment on this block) or be unexported Open
KeyStateEnabled KeyState = KeyState(SDK.KeyStateEnabled)
- Exclude checks
exported type ExpirationModelType should have comment or be unexported Open
type ExpirationModelType string
- Exclude checks
exported const CustomerMasterKeySpecRsa2048 should have comment (or a comment on this block) or be unexported Open
CustomerMasterKeySpecRsa2048 CustomerMasterKeySpec = CustomerMasterKeySpec(SDK.CustomerMasterKeySpecRsa2048)
- Exclude checks
exported const KeyManagerTypeAws should have comment (or a comment on this block) or be unexported Open
KeyManagerTypeAws KeyManagerType = KeyManagerType(SDK.KeyManagerTypeAws)
- Exclude checks
exported const OriginTypeAwsKms should have comment (or a comment on this block) or be unexported Open
OriginTypeAwsKms OriginType = OriginType(SDK.OriginTypeAwsKms)
- Exclude checks
exported type SigningAlgorithmSpec should have comment or be unexported Open
type SigningAlgorithmSpec string
- Exclude checks
exported const KeyUsageTypeSignVerify should have comment (or a comment on this block) or be unexported Open
KeyUsageTypeSignVerify KeyUsageType = KeyUsageType(SDK.KeyUsageTypeSignVerify)
- Exclude checks
exported type OriginType should have comment or be unexported Open
type OriginType string
- Exclude checks