Showing 1,008 of 1,820 total issues
Function validateClusterSpec
has 8 return statements (exceeds 4 allowed). Open
Open
func validateClusterSpec(spec *api.ClusterSpec) error {
if spec == nil {
return status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
}
Method Allocator.allocateTask
has 8 return statements (exceeds 4 allowed). Open
Open
func (a *Allocator) allocateTask(ctx context.Context, t *api.Task) (err error) {
taskUpdated := false
nc := a.netCtx
logger := log.G(ctx).WithField("method", "(*Allocator).allocateTask")
Method LogBroker.PublishLogs
has 8 return statements (exceeds 4 allowed). Open
Open
func (lb *LogBroker) PublishLogs(stream api.LogBroker_PublishLogsServer) (err error) {
remote, err := ca.RemoteNode(stream.Context())
if err != nil {
return err
}
Method LogBroker.ListenSubscriptions
has 8 return statements (exceeds 4 allowed). Open
Open
func (lb *LogBroker) ListenSubscriptions(request *api.ListenSubscriptionsRequest, stream api.LogBroker_ListenSubscriptionsServer) error {
remote, err := ca.RemoteNode(stream.Context())
if err != nil {
return err
}
Method Node.loadAndStart
has 8 return statements (exceeds 4 allowed). Open
Open
func (n *Node) loadAndStart(ctx context.Context, forceNewCluster bool) error {
snapshot, waldata, err := n.readFromDisk(ctx)
if err != nil {
return err
}
Method portAllocator.isPortsAllocatedOnInit
has 8 return statements (exceeds 4 allowed). Open
Open
func (pa *portAllocator) isPortsAllocatedOnInit(s *api.Service, onInit bool) bool {
// If service has no user-defined endpoint and allocated endpoint,
// we assume it is allocated and return true.
if s.Endpoint == nil && s.Spec.Endpoint == nil {
return true
Method Node.JoinAndStart
has 8 return statements (exceeds 4 allowed). Open
Open
func (n *Node) JoinAndStart(ctx context.Context) (err error) {
ctx, cancel := n.WithContext(ctx)
defer func() {
cancel()
if err != nil {
Method StubAPIClient.ContainerCreate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (sa *StubAPIClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networking *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error) {
Method controller.Remove
has 7 return statements (exceeds 4 allowed). Open
Open
func (r *controller) Remove(ctx context.Context) error {
if err := r.checkClosed(); err != nil {
return err
}
Method nodePlugin.NodeUnstageVolume
has 7 return statements (exceeds 4 allowed). Open
Open
func (np *nodePlugin) NodeUnstageVolume(ctx context.Context, req *api.VolumeAssignment) error {
np.mu.Lock()
defer np.mu.Unlock()
if !np.staging {
return nil
Avoid deeply nested control flow statements. Open
Open
if container := actype.Task.Spec.GetContainer(); container != nil {
container.Env = []string{"ENVVARS REDACTED"}
if container.PullOptions != nil {
container.PullOptions.RegistryAuth = "REDACTED"
}
Avoid deeply nested control flow statements. Open
Open
if err != nil {
return err
}
Function decryptRaftData
has 7 return statements (exceeds 4 allowed). Open
Open
func decryptRaftData(swarmdir, outdir, unlockKey string) error {
krw, err := getKRW(swarmdir, unlockKey)
if err != nil {
return err
}
Function parseTmpfs
has 7 return statements (exceeds 4 allowed). Open
Open
func parseTmpfs(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
if flags.Changed("tmpfs") {
tmpfss, err := flags.GetStringSlice("tmpfs")
if err != nil {
return err
Avoid deeply nested control flow statements. Open
Open
if container := actype.Service.Spec.Task.GetContainer(); container != nil {
container.Env = []string{"ENVVARS REDACTED"}
if container.PullOptions != nil {
container.PullOptions.RegistryAuth = "REDACTED"
}
Avoid deeply nested control flow statements. Open
Open
switch suffix {
case 'g':
multiplier = 1 << 30
case 'm':
multiplier = 1 << 20
Function parseRestart
has 7 return statements (exceeds 4 allowed). Open
Open
func parseRestart(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
if spec.Task.Restart == nil {
// set new service's restart policy as RestartOnAny
spec.Task.Restart = &api.RestartPolicy{
Condition: api.RestartOnAny,
Avoid deeply nested control flow statements. Open
Open
} else if fieldNum == 2 {
var stringLenmapvalue uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObjects
Avoid deeply nested control flow statements. Open
Open
if postStringIndexmapkey < 0 {
return ErrInvalidLengthObjects
}
Avoid deeply nested control flow statements. Open
Open
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}