Showing 1,008 of 1,820 total issues
Method PublishLogsMessage.Unmarshal
has 25 return statements (exceeds 4 allowed). Open
Open
func (m *PublishLogsMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method NodeSpec.Unmarshal
has 25 return statements (exceeds 4 allowed). Open
Open
func (m *NodeSpec) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method WatchRequest_WatchEntry.Unmarshal
has 25 return statements (exceeds 4 allowed). Open
Open
func (m *WatchRequest_WatchEntry) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Updater.updateTask
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
Open
func (u *Updater) updateTask(ctx context.Context, slot orchestrator.Slot, updated *api.Task, order api.UpdateConfig_UpdateOrder) error {
// Kick off the watch before even creating the updated task. This is in order to avoid missing any event.
taskUpdates, cancel := state.Watch(u.watchQueue, api.EventUpdateTask{
Task: &api.Task{ID: updated.ID},
Checks: []api.TaskCheckFunc{api.TaskCheckID},
- 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 Allocator.allocateTasks
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
Open
func (a *Allocator) allocateTasks(ctx context.Context, existingAddressesOnly bool) error {
var (
nc = a.netCtx
tasks []*api.Task
allocatedTasks []*api.Task
- 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 GetRootCACertificateResponse.Unmarshal
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *GetRootCACertificateResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method SubscribeLogsMessage.Unmarshal
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *SubscribeLogsMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method TasksMessage.Unmarshal
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *TasksMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Node.loadAndStart
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (n *Node) loadAndStart(ctx context.Context, forceNewCluster bool) error {
snapshot, waldata, err := n.readFromDisk(ctx)
if err != nil {
return err
}
Method HeartbeatResponse.Unmarshal
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *HeartbeatResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Function validateCAConfig
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func validateCAConfig(ctx context.Context, securityConfig *ca.SecurityConfig, cluster *api.Cluster) (*api.RootCA, error) {
newConfig := cluster.Spec.CAConfig.Copy()
newConfig.SigningCACert = ca.NormalizePEMs(newConfig.SigningCACert) // ensure this is normalized before we use it
if len(newConfig.SigningCAKey) > 0 && len(newConfig.SigningCACert) == 0 {
TaskSpec
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type TaskSpec struct {
// Types that are valid to be assigned to Runtime:
// *TaskSpec_Attachment
// *TaskSpec_Container
// *TaskSpec_Generic
Method NodeCertificateStatusRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *NodeCertificateStatusRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method HealthCheckRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *HealthCheckRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method AttachNetworkResponse.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *AttachNetworkResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method DetachNetworkRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *DetachNetworkRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method HeartbeatRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *HeartbeatRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method AssignmentsRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *AssignmentsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method TasksRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *TasksRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method NetworkAttachmentSpec.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *NetworkAttachmentSpec) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx