Showing 56 of 208 total issues
Method executionServer.Stream
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (s *executionServer) Stream(req *ExecutionStreamRequest, stream Execution_StreamServer) error {
// check authorization
if err := s.auth.IsAuthorized(stream.Context(), req); err != nil {
return err
}
- 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 Server.Execution
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func (s *Server) Execution(req *ExecutionRequest, stream Runner_ExecutionServer) error {
// check authorization and get runner hash
runnerHash, err := s.isAuthorized(stream.Context())
if err != nil {
return err
- 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 runnerServer.Register
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *runnerServer) Register(ctx context.Context, req *RunnerRegisterRequest) (*RunnerRegisterResponse, error) {
// check authorization
if err := s.auth.IsAuthorized(ctx, req); err != nil {
return nil, err
}
Method Keeper.Create
has 16 return statements (exceeds 6 allowed). Open
func (k *Keeper) Create(ctx sdk.Context, msg types.MsgCreate) (*executionpb.Execution, error) {
run, err := k.runnerKeeper.Get(ctx, msg.ExecutorHash)
if err != nil {
return nil, err
}
Method Service.validateData
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (s *Service) validateData() error {
var errs xerrors.Errors
if err := s.areKeysUnique(); err != nil {
errs = append(errs, err)
}
- 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 Container.Start
has 15 return statements (exceeds 6 allowed). Open
func (c *Container) Start(srv *service.Service, instanceHash, runnerHash, instanceEnvHash hash.Hash, instanceEnv []string, registerPayload []byte) (err error) {
// delete the service's container on any error
errorOccurred := true
defer func() {
if errorOccurred {
Method Server.Execution
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *Server) Execution(req *ExecutionRequest, stream Runner_ExecutionServer) error {
// check authorization and get runner hash
runnerHash, err := s.isAuthorized(stream.Context())
if err != nil {
return err
Method Keeper.Update
has 12 return statements (exceeds 6 allowed). Open
func (k *Keeper) Update(ctx sdk.Context, msg types.MsgUpdate) (*executionpb.Execution, error) {
store := ctx.KVStore(k.storeKey)
if !store.Has(msg.Hash) {
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "execution %q doesn't exist", msg.Hash)
}
Method runnerServer.Register
has 12 return statements (exceeds 6 allowed). Open
func (s *runnerServer) Register(ctx context.Context, req *RunnerRegisterRequest) (*RunnerRegisterResponse, error) {
// check authorization
if err := s.auth.IsAuthorized(ctx, req); err != nil {
return nil, err
}
Function AddGenesisAccountCmd
has 12 return statements (exceeds 6 allowed). Open
func AddGenesisAccountCmd(
ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string,
) *cobra.Command {
cmd := &cobra.Command{
Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
Function NewInitApp
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
invCheckPeriod uint, skipUpgradeHeights map[int64]bool, baseAppOptions ...func(*bam.BaseApp),
Function NewKeeper
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
cdc *codec.Codec,
key sdk.StoreKey,
serviceKeeper types.ServiceKeeper,
instanceKeeper types.InstanceKeeper,
runnerKeeper types.RunnerKeeper,
Function IsDomainName
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func IsDomainName(s string) bool {
// See RFC 1035, RFC 3696.
// Presentation format has dots before every label except the first, and the
// terminal empty label is optional here because we assume fully-qualified
// (absolute) input. We must therefore reserve space for the first and last
- 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 Process_Node_Reference_Path.Resolve
has 9 return statements (exceeds 6 allowed). Open
func (path *Process_Node_Reference_Path) Resolve(data *types.Struct) (*types.Value, error) {
if path == nil {
return &types.Value{Kind: &types.Value_StructValue{StructValue: data}}, nil
}
Function New
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func New(sid, name, description string, configuration Service_Configuration, tasks []*Service_Task, events []*Service_Event, dependencies []*Service_Dependency, repository, source string) (*Service, error) {
Method Orchestrator.processTask
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func (s *Orchestrator) processTask(node *process.Process_Node, task *process.Process_Node_Task, wf *process.Process, exec *execution.Execution, event *event.Event, data *types.Struct) (hash.Hash, error) {
Function exportAppStateAndTMValidators
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string,
Method Keeper.Create
has 8 return statements (exceeds 6 allowed). Open
func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreate) (*processpb.Process, error) {
store := ctx.KVStore(k.storeKey)
p, err := process.New(msg.Name, msg.Nodes, msg.Edges, msg.Owner)
if err != nil {
Method Server.Execution
has 8 return statements (exceeds 6 allowed). Open
func (s *Server) Execution(req *ExecutionRequest, stream Runner_ExecutionServer) error {
// check authorization and get runner hash
runnerHash, err := s.isAuthorized(stream.Context())
if err != nil {
return err
Function startOrchestratorCmd
has 8 return statements (exceeds 6 allowed). Open
func startOrchestratorCmd(cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "start",
Short: "Start the Orchestrator",
RunE: func(cmd *cobra.Command, args []string) error {