Showing 18 of 48 total issues
Method StringsRegistry.transformString
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (sr *StringsRegistry) transformString(style caseStyle, str string) string {
var result strings.Builder
result.Grow(len(str) + 10) // Allocate a bit more for potential separators
capitalizeNext := style.CapitalizeNext
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method RandomRegistry.randomString
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func (rr *RandomRegistry) randomString(count int, opts *randomOpts) string {
if count <= 0 {
return ""
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method TimeRegistry.DurationRound
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (tr *TimeRegistry) DurationRound(duration any) string {
var d time.Duration
switch duration := duration.(type) {
case string:
Method CryptoRegistry.parsePrivateKeyPEM
has 10 return statements (exceeds 4 allowed). Open
func (ch *CryptoRegistry) parsePrivateKeyPEM(pemBlock string) (crypto.PrivateKey, error) {
block, _ := pem.Decode([]byte(pemBlock))
if block == nil {
return nil, errors.New("no PEM data in input")
}
Method SlicesRegistry.Slice
has 8 return statements (exceeds 4 allowed). Open
func (sr *SlicesRegistry) Slice(args ...any) (any, error) {
// ! BACKWARDS COMPATIBILITY: deprecated in v1.0 and removed in v1.1
// ! Due to change in signature, this function still supports the old signature
// ! to let users transition to the new signature.
// * Old signature: Slice(list any, indices ...any)
Method StringsRegistry.wordWrap
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (sr *StringsRegistry) wordWrap(wrapLength int, newLineCharacter string, wrapLongWords bool, str string) string {
if wrapLength < 1 {
wrapLength = 1
}
if newLineCharacter == "" {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method CryptoRegistry.generateSignedCertificateWithKeyInternal
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
cn string,
ips []any,
alternateDNS []any,
daysValid int,
ca Certificate,
Method CryptoRegistry.GenerateSignedCertificateWithPEMKey
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
cn string,
ips []any,
alternateDNS []any,
daysValid int,
ca Certificate,
Method CryptoRegistry.BuildCustomCertificate
has 6 return statements (exceeds 4 allowed). Open
func (ch *CryptoRegistry) BuildCustomCertificate(b64cert string, b64key string) (Certificate, error) {
crt := Certificate{}
cert, err := base64.StdEncoding.DecodeString(b64cert)
if err != nil {
Method CryptoRegistry.generateSelfSignedCertificateWithKeyInternal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
cn string,
ips []any,
alternateDNS []any,
daysValid int,
priv crypto.PrivateKey,
Method CryptoRegistry.GenerateSignedCertificate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
cn string,
ips []any,
alternateDNS []any,
daysValid int,
ca Certificate,
Method CryptoRegistry.GenerateSelfSignedCertificateWithPEMKey
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
cn string,
ips []any,
alternateDNS []any,
daysValid int,
privPEM string,
Function StrSlice
has 5 return statements (exceeds 4 allowed). Open
func StrSlice(value any) []string {
if value == nil {
return []string{}
}
Method CryptoRegistry.generateSignedCertificateWithKeyInternal
has 5 return statements (exceeds 4 allowed). Open
func (ch *CryptoRegistry) generateSignedCertificateWithKeyInternal(
cn string,
ips []any,
alternateDNS []any,
daysValid int,
Method MapsRegistry.Omit
has 5 return statements (exceeds 4 allowed). Open
func (mr *MapsRegistry) Omit(args ...any) (map[string]any, error) {
// ! BACKWARDS COMPATIBILITY: deprecated in v1.0 and removed in v1.1
// ! Due to change in signature, this function still supports the old signature
// ! to let users transition to the new signature.
// * Old signature: Omit(map[string]any, ...string)
Method MapsRegistry.Pick
has 5 return statements (exceeds 4 allowed). Open
func (mr *MapsRegistry) Pick(args ...any) (map[string]any, error) {
// ! BACKWARDS COMPATIBILITY: deprecated in v1.0 and removed in v1.1
// ! Due to change in signature, this function still supports the old signature
// ! to let users transition to the new signature.
// * Old signature: Pick(map[string]any, ...string)
Method SlicesRegistry.Append
has 5 return statements (exceeds 4 allowed). Open
func (sr *SlicesRegistry) Append(args ...any) ([]any, error) {
// ! BACKWARDS COMPATIBILITY: deprecated in v1.0 and removed in v1.1
// ! Due to change in signature, this function still supports the old signature
// ! to let users transition to the new signature.
// * Old signature: Append(list any, v any)
Method CryptoRegistry.getCertAndKey
has 5 return statements (exceeds 4 allowed). Open
func (ch *CryptoRegistry) getCertAndKey(
template *x509.Certificate,
signeeKey crypto.PrivateKey,
parent *x509.Certificate,
signingKey crypto.PrivateKey,