Showing 1,008 of 1,820 total issues
Method raftProxyDispatcherServer.Heartbeat
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyDispatcherServer) Heartbeat(ctx context.Context, r *HeartbeatRequest) (*HeartbeatResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method PublishLogsResponse.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *PublishLogsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method raftProxyDispatcherServer.UpdateVolumeStatus
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyDispatcherServer) UpdateVolumeStatus(ctx context.Context, r *UpdateVolumeStatusRequest) (*UpdateVolumeStatusResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method raftProxyLogBrokerServer.PublishLogs
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyLogBrokerServer) PublishLogs(stream LogBroker_PublishLogsServer) error {
ctx := stream.Context()
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method UpdateTaskStatusResponse.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *UpdateTaskStatusResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method ListenSubscriptionsRequest.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *ListenSubscriptionsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method UpdateVolumeStatusResponse.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *UpdateVolumeStatusResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method raftProxyDispatcherServer.UpdateTaskStatus
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyDispatcherServer) UpdateTaskStatus(ctx context.Context, r *UpdateTaskStatusRequest) (*UpdateTaskStatusResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method GlobalJob.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *GlobalJob) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method ClusterSpec.MarshalToSizedBuffer
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *ClusterSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
Method GlobalService.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *GlobalService) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method raftProxyRaftServer.ResolveAddress
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyRaftServer) ResolveAddress(ctx context.Context, r *ResolveAddressRequest) (*ResolveAddressResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method ProcessRaftMessageResponse.Unmarshal
has 9 return statements (exceeds 4 allowed). Open
Open
func (m *ProcessRaftMessageResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method raftProxyRaftMembershipServer.Join
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyRaftMembershipServer) Join(ctx context.Context, r *JoinRequest) (*JoinResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method Server.signNodeCert
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func (s *Server) signNodeCert(ctx context.Context, node *api.Node) error {
s.signingMu.Lock()
rootCA := s.localRootCA
externalCA := s.externalCA
s.signingMu.Unlock()
- 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.NodeCertificateStatus
has 9 return statements (exceeds 4 allowed). Open
Open
func (s *Server) NodeCertificateStatus(ctx context.Context, request *api.NodeCertificateStatusRequest) (*api.NodeCertificateStatusResponse, error) {
if request.NodeID == "" {
return nil, status.Errorf(codes.InvalidArgument, codes.InvalidArgument.String())
}
Function makeExternalSignRequest
has 9 return statements (exceeds 4 allowed). Open
Open
func makeExternalSignRequest(ctx context.Context, client *http.Client, url string, csrJSON []byte) (cert []byte, err error) {
resp, err := ctxhttp.Post(ctx, client, url, "application/json", bytes.NewReader(csrJSON))
if err != nil {
return nil, recoverableErr{err: errors.Wrap(err, "unable to perform certificate signing request")}
}
Method raftProxyRaftServer.StreamRaftMessage
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyRaftServer) StreamRaftMessage(stream Raft_StreamRaftMessageServer) error {
ctx := stream.Context()
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method raftProxyRaftMembershipServer.Leave
has 9 return statements (exceeds 4 allowed). Open
Open
func (p *raftProxyRaftMembershipServer) Leave(ctx context.Context, r *LeaveRequest) (*LeaveResponse, error) {
conn, err := p.connSelector.LeaderConn(ctx)
if err != nil {
if err == raftselector.ErrIsLeader {
Method Server.signNodeCert
has 9 return statements (exceeds 4 allowed). Open
Open
func (s *Server) signNodeCert(ctx context.Context, node *api.Node) error {
s.signingMu.Lock()
rootCA := s.localRootCA
externalCA := s.externalCA
s.signingMu.Unlock()