Showing 1,008 of 1,820 total issues
Method session.sendTaskStatuses
has 6 return statements (exceeds 4 allowed). Open
Open
func (s *session) sendTaskStatuses(ctx context.Context, updates ...*api.UpdateTaskStatusRequest_TaskStatusUpdate) ([]*api.UpdateTaskStatusRequest_TaskStatusUpdate, error) {
if len(updates) < 1 {
return nil, nil
}
Method nodePlugin.init
has 6 return statements (exceeds 4 allowed). Open
Open
func (np *nodePlugin) init(ctx context.Context) error {
probe, err := np.idClient.Probe(ctx, &csi.ProbeRequest{})
if err != nil {
return err
}
Function changeNodeRole
has 6 return statements (exceeds 4 allowed). Open
Open
func changeNodeRole(cmd *cobra.Command, args []string, role api.NodeRole) error {
if len(args) == 0 {
return errors.New("missing node ID")
}
Function changeNodeAvailability
has 6 return statements (exceeds 4 allowed). Open
Open
func changeNodeAvailability(cmd *cobra.Command, args []string, availability api.NodeSpec_Availability) error {
if len(args) == 0 {
return errors.New("missing node ID")
}
Function expandMounts
has 6 return statements (exceeds 4 allowed). Open
Open
func expandMounts(ctx Context, mounts []api.Mount) ([]api.Mount, error) {
if len(mounts) == 0 {
return mounts, nil
}
Method Agent.run
has 6 return statements (exceeds 4 allowed). Open
Open
func (a *Agent) run(ctx context.Context) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
defer close(a.closed) // full shutdown.
Method session.watch
has 6 return statements (exceeds 4 allowed). Open
Open
func (s *session) watch(ctx context.Context) error {
logger := log.G(ctx).WithFields(log.Fields{"method": "(*session).watch"})
logger.Debugf("")
var (
resp *api.AssignmentsMessage
Function dumpSnapshot
has 6 return statements (exceeds 4 allowed). Open
Open
func dumpSnapshot(swarmdir, unlockKey string, redact bool) error {
_, snapshot, err := loadData(swarmdir, unlockKey)
if err != nil {
return err
}
Function ParseAddConfig
has 6 return statements (exceeds 4 allowed). Open
Open
func ParseAddConfig(cmd *cobra.Command, spec *api.ServiceSpec, flagName string) error {
flags := cmd.Flags()
if flags.Changed(flagName) {
configs, err := flags.GetStringSlice(flagName)
Method controller.waitReady
has 6 return statements (exceeds 4 allowed). Open
Open
func (r *controller) waitReady(pctx context.Context) error {
if err := r.checkClosed(); err != nil {
return err
}
Function remove
has 6 return statements (exceeds 4 allowed). Open
Open
func remove(na, r *api.GenericResource) bool {
switch tr := r.Resource.(type) {
case *api.GenericResource_DiscreteResourceSpec:
if na.GetDiscreteResourceSpec() == nil {
return false // Type change, ignore
Function HasResource
has 6 return statements (exceeds 4 allowed). Open
Open
func HasResource(res *api.GenericResource, resources []*api.GenericResource) bool {
for _, r := range resources {
if Kind(res) != Kind(r) {
continue
}
Function HasEnough
has 6 return statements (exceeds 4 allowed). Open
Open
func HasEnough(nodeRes []*api.GenericResource, taskRes *api.GenericResource) (bool, error) {
t := taskRes.GetDiscreteResourceSpec()
if t == nil {
return false, fmt.Errorf("task should only hold Discrete type")
}
Function parseExternalCA
has 6 return statements (exceeds 4 allowed). Open
Open
func parseExternalCA(caSpec string) (*api.ExternalCA, error) {
csvReader := csv.NewReader(strings.NewReader(caSpec))
fields, err := csvReader.Read()
if err != nil {
return nil, err
Method Orchestrator.reconcileOneNode
has 6 return statements (exceeds 4 allowed). Open
Open
func (g *Orchestrator) reconcileOneNode(ctx context.Context, node *api.Node) {
if node.Spec.Availability == api.NodeAvailabilityDrain {
log.G(ctx).Debugf("global orchestrator: node %s in drain state, shutting down its tasks", node.ID)
g.foreachTaskFromNode(ctx, node, g.shutdownTask)
return
Function RemoteNode
has 6 return statements (exceeds 4 allowed). Open
Open
func RemoteNode(ctx context.Context) (RemoteNodeInfo, error) {
// If we have a value on the context that marks this as a local
// request, we return the node info from the context.
localNodeInfo := ctx.Value(LocalRequestKey)
Method Orchestrator.Run
has 6 return statements (exceeds 4 allowed). Open
Open
func (g *Orchestrator) Run(ctx context.Context) error {
defer close(g.doneChan)
// Watch changes to services and tasks
queue := g.store.WatchQueue()
Function ParseJoinToken
has 6 return statements (exceeds 4 allowed). Open
Open
func ParseJoinToken(token string) (*ParsedJoinToken, error) {
split := strings.Split(token, "-")
numParts := len(split)
// v1 has 4, v2 has 5
Method Reconciler.ReconcileService
has 6 return statements (exceeds 4 allowed). Open
Open
func (r *Reconciler) ReconcileService(id string) error {
var (
service *api.Service
cluster *api.Cluster
tasks []*api.Task
Method Server.Run
has 6 return statements (exceeds 4 allowed). Open
Open
func (s *Server) Run(ctx context.Context) error {
s.mu.Lock()
if s.isRunning() {
s.mu.Unlock()
return errors.New("CA signer is already running")