internal/codegen/run.go
Function getNativeTypeName
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func getNativeTypeName(field *descriptorpb.FieldDescriptorProto, message *descriptorpb.DescriptorProto, pkgName string, fileExports []string) string {
repeatedStr := ""
if field.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REPEATED {
repeatedStr = "[]"
}
Function generateImportsForMethod
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func generateImportsForMethod(f *descriptorpb.MethodDescriptorProto, ownPkg string, fileName string, importMap map[string][]string, content *strings.Builder, impexp importsExports) (useGoogle bool) {
for _, typeName := range []string{f.GetInputType(), f.GetOutputType()} {
if typeName == "" {
continue
}
- 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
Function generateImportsForMethod
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func generateImportsForMethod(f *descriptorpb.MethodDescriptorProto, ownPkg string, fileName string, importMap map[string][]string, content *strings.Builder, impexp importsExports) (useGoogle bool) {
Function generateService
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func generateService(f *descriptorpb.FileDescriptorProto, service *descriptorpb.ServiceDescriptorProto, content *strings.Builder, impexp importsExports, parsedMethods map[string]parsedMethod) {
Function getNativeTypeName
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func getNativeTypeName(field *descriptorpb.FieldDescriptorProto, message *descriptorpb.DescriptorProto, pkgName string, fileExports []string) string {
repeatedStr := ""
if field.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REPEATED {
repeatedStr = "[]"
}
- 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"