Showing 1,820 of 1,820 total issues
Method GlobalJob.Unmarshal
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (m *GlobalJob) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
- 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 ProcessRaftMessageResponse.Unmarshal
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (m *ProcessRaftMessageResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
- 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 InternalRaftRequest.Unmarshal
has 19 return statements (exceeds 4 allowed). Open
func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method test.Generate
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool {
used := false
testingPkg := imports.NewImport("testing")
randPkg := imports.NewImport("math/rand")
timePkg := imports.NewImport("time")
- 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
Function watchNetwork
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func watchNetwork(t *testing.T, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, n *api.Network) bool) {
for {
var network *api.Network
select {
case event := <-watch:
- 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
Function watchTask
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func watchTask(t *testing.T, s *store.MemoryStore, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, s *store.MemoryStore, n *api.Task) bool) {
for {
var task *api.Task
select {
case event := <-watch:
- 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
Function watchService
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func watchService(t *testing.T, watch chan events.Event, expectTimeout bool, fn func(t assert.TestingT, n *api.Service) bool) {
for {
var service *api.Service
select {
case event := <-watch:
- 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
Function watchNode
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func watchNode(t *testing.T, watch chan events.Event, expectTimeout bool,
fn func(t assert.TestingT, originalNode, updatedNode *api.Node, networks []string) bool,
originalNode *api.Node,
networks []string) {
for {
- 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 Dispatcher.Run
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (d *Dispatcher) Run(ctx context.Context) error {
ctx = log.WithModule(ctx, "dispatcher")
log.G(ctx).Info("dispatcher starting")
d.taskUpdatesLock.Lock()
- 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 worker.Subscribe
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (w *worker) Subscribe(ctx context.Context, subscription *api.SubscriptionMessage) error {
log.G(ctx).Debugf("Received subscription %s (selector: %v)", subscription.ID, subscription.Selector)
publisher, cancel, err := w.publisherProvider.Publisher(ctx, subscription.ID)
if err != nil {
Method Volume.MarshalToSizedBuffer
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *Volume) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
Method Task.Size
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *Task) Size() (n int) {
if m == nil {
return 0
}
var l int
Method Supervisor.Restart
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *Supervisor) Restart(ctx context.Context, tx store.Tx, cluster *api.Cluster, service *api.Service, t api.Task) error {
// TODO(aluzzardi): This function should not depend on `service`.
// Is the old task still in the process of restarting? If so, wait for
// its restart delay to elapse, to avoid tight restart loops (for
Method roleManager.Run
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (rm *roleManager) Run(ctx context.Context) {
defer close(rm.doneChan)
var (
nodes []*api.Node
Method StoreSnapshot.String
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (this *StoreSnapshot) String() string {
if this == nil {
return "nil"
}
repeatedStringForNodes := "[]*Node{"
Method deepCopyGen.genMsgDeepCopy
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (d *deepCopyGen) genMsgDeepCopy(m *generator.Descriptor) {
ccTypeName := generator.CamelCaseSlice(m.TypeName())
// Generate backwards compatible, type-safe Copy() function.
d.P("func (m *", ccTypeName, ") Copy() *", ccTypeName, "{")
Function Merge
has 18 return statements (exceeds 4 allowed). Open
func Merge(cmd *cobra.Command, spec *api.ServiceSpec, c api.ControlClient) error {
flags := cmd.Flags()
if flags.Changed("force") {
force, err := flags.GetBool("force")
Method IssueNodeCertificateResponse.Unmarshal
has 18 return statements (exceeds 4 allowed). Open
func (m *IssueNodeCertificateResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method UpdateVolumeStatusRequest_VolumeStatusUpdate.Unmarshal
has 18 return statements (exceeds 4 allowed). Open
func (m *UpdateVolumeStatusRequest_VolumeStatusUpdate) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method SelectBySlot.Unmarshal
has 18 return statements (exceeds 4 allowed). Open
func (m *SelectBySlot) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx