Showing 1,008 of 1,820 total issues
Function ConvertNodeWatch
has 10 return statements (exceeds 4 allowed). Open
Open
func ConvertNodeWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
var (
m Node
checkFuncs []NodeCheckFunc
hasRole bool
Method Server.IssueNodeCertificate
has 10 return statements (exceeds 4 allowed). Open
Open
func (s *Server) IssueNodeCertificate(ctx context.Context, request *api.IssueNodeCertificateRequest) (*api.IssueNodeCertificateResponse, error) {
// First, let's see if the remote node is presenting a non-empty CSR
if len(request.CSR) == 0 {
return nil, status.Errorf(codes.InvalidArgument, codes.InvalidArgument.String())
}
Method Supervisor.shouldRestart
has 10 return statements (exceeds 4 allowed). Open
Open
func (r *Supervisor) shouldRestart(ctx context.Context, t *api.Task, service *api.Service) bool {
// TODO(aluzzardi): This function should not depend on `service`.
// There are 3 possible restart policies.
switch orchestrator.RestartCondition(t) {
case api.RestartOnAny:
Method Server.UpdateNode
has 10 return statements (exceeds 4 allowed). Open
Open
func (s *Server) UpdateNode(ctx context.Context, request *api.UpdateNodeRequest) (*api.UpdateNodeResponse, error) {
if request.NodeID == "" || request.NodeVersion == nil {
return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
}
if err := validateNodeSpec(request.Spec); err != nil {
Method Dispatcher.Tasks
has 10 return statements (exceeds 4 allowed). Open
Open
func (d *Dispatcher) Tasks(r *api.TasksRequest, stream api.Dispatcher_TasksServer) error {
d.rpcRW.RLock()
defer d.rpcRW.RUnlock()
dctx, err := d.isRunningLocked()
Method testSuite.TestNodeAllocator
has 10 return statements (exceeds 4 allowed). Open
Open
func (suite *testSuite) TestNodeAllocator() {
s := store.NewMemoryStore(nil)
suite.NotNil(s)
defer s.Close()
Method raftProxyNodeCAServer.NodeCertificateStatus
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyNodeCAServer) NodeCertificateStatus(ctx context.Context, r *NodeCertificateStatusRequest) (*NodeCertificateStatusResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method controller.Wait
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func (r *controller) Wait(ctx context.Context) error {
if err := r.checkClosed(); 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 raftProxyHealthServer.Check
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyHealthServer) Check(ctx context.Context, r *HealthCheckRequest) (*HealthCheckResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method raftProxyNodeCAServer.IssueNodeCertificate
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyNodeCAServer) IssueNodeCertificate(ctx context.Context, r *IssueNodeCertificateRequest) (*IssueNodeCertificateResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method raftProxyCAServer.GetUnlockKey
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyCAServer) GetUnlockKey(ctx context.Context, r *GetUnlockKeyRequest) (*GetUnlockKeyResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Function getMountMask
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func getMountMask(m *api.Mount) string {
var maskOpts []string
if m.ReadOnly {
maskOpts = append(maskOpts, "ro")
}
- 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 raftProxyCAServer.GetRootCACertificate
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyCAServer) GetRootCACertificate(ctx context.Context, r *GetRootCACertificateRequest) (*GetRootCACertificateResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method DetachNetworkResponse.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *DetachNetworkResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method raftProxyResourceAllocatorServer.DetachNetwork
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyResourceAllocatorServer) DetachNetwork(ctx context.Context, r *DetachNetworkRequest) (*DetachNetworkResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method Node.MarshalToSizedBuffer
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
Method Service.MarshalToSizedBuffer
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
Method raftProxyResourceAllocatorServer.AttachNetwork
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyResourceAllocatorServer) AttachNetwork(ctx context.Context, r *AttachNetworkRequest) (*AttachNetworkResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method GetRootCACertificateRequest.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *GetRootCACertificateRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method GetUnlockKeyRequest.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *GetUnlockKeyRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx