go_sdk.go
Method Streamdal.Process
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
Open
func (s *Streamdal) Process(ctx context.Context, req *ProcessRequest) *ProcessResponse {
resp := &ProcessResponse{
PipelineStatus: make([]*protos.PipelineStatus, 0),
Metadata: make(map[string]string),
}
- 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 Streamdal.Process
has 178 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *Streamdal) Process(ctx context.Context, req *ProcessRequest) *ProcessResponse {
resp := &ProcessResponse{
PipelineStatus: make([]*protos.PipelineStatus, 0),
Metadata: make(map[string]string),
}
File go_sdk.go
has 648 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Package streamdal is a library that allows running of Client data pipelines against data
// This package is designed to be included in golang message bus libraries. The only public
// method is Process() which is used to run pipelines against data.
//
// Use of this package requires a running instance of a streamdal serverĀ©.
Function New
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func New(cfg *Config) (*Streamdal, error) {
if err := validateConfig(cfg); err != nil {
return nil, errors.Wrap(err, "unable to validate config")
}
Function New
has 9 return statements (exceeds 4 allowed). Open
Open
func New(cfg *Config) (*Streamdal, error) {
if err := validateConfig(cfg); err != nil {
return nil, errors.Wrap(err, "unable to validate config")
}
Method Streamdal.handleCondition
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ctx context.Context,
req *ProcessRequest,
resp *ProcessResponse,
stepCond *protos.PipelineStepConditions,
step *protos.PipelineStep,
Method Streamdal.Process
has 7 return statements (exceeds 4 allowed). Open
Open
func (s *Streamdal) Process(ctx context.Context, req *ProcessRequest) *ProcessResponse {
resp := &ProcessResponse{
PipelineStatus: make([]*protos.PipelineStatus, 0),
Metadata: make(map[string]string),
}
Function validateConfig
has 6 return statements (exceeds 4 allowed). Wontfix
Wontfix
func validateConfig(cfg *Config) error {
if cfg == nil {
return ErrEmptyConfig
}
Method Streamdal.runStep
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (s *Streamdal) runStep(ctx context.Context, aud *protos.Audience, step *protos.PipelineStep, data []byte, isr *protos.InterStepResult) (*protos.WASMResponse, error) {
Function validateProcessRequest
has 5 return statements (exceeds 4 allowed). Wontfix
Wontfix
func validateProcessRequest(req *ProcessRequest) error {
if req == nil {
return ErrEmptyProcessRequest
}
Method Streamdal.runStep
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *Streamdal) runStep(ctx context.Context, aud *protos.Audience, step *protos.PipelineStep, data []byte, isr *protos.InterStepResult) (*protos.WASMResponse, error) {
s.config.Logger.Debugf("Running step '%s'", step.Name)
// Get WASM module
f, err := s.getFunction(ctx, step)
Function validateConfig
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Wontfix
Wontfix
func validateConfig(cfg *Config) error {
if cfg == nil {
return ErrEmptyConfig
}
- 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"