Showing 1,008 of 1,820 total issues
Method ContainerSpec_PullOptions.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *ContainerSpec_PullOptions) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method TLSRenewer.Start
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (t *TLSRenewer) Start(ctx context.Context) <-chan CertificateUpdate {
updates := make(chan CertificateUpdate)
go func() {
var (
Method ResolveAddressResponse.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *ResolveAddressResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method JoinRequest.Unmarshal
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *JoinRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method test.Generate
has 79 lines of code (exceeds 50 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")
Method Server.checkPortConflicts
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *Server) checkPortConflicts(spec *api.ServiceSpec, serviceID string) error {
if spec.Endpoint == nil {
return nil
}
Method Agent.handleSessionMessage
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func (a *Agent) handleSessionMessage(ctx context.Context, message *api.SessionMessage, nti *api.NodeTLSInfo) error {
seen := map[api.Peer]struct{}{}
for _, manager := range message.Managers {
if manager.Peer.Addr == "" {
continue
- 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 NodeCertificateStatusResponse.Unmarshal
has 23 return statements (exceeds 4 allowed). Open
func (m *NodeCertificateStatusResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Function printNodeSummary
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func printNodeSummary(node *api.Node) {
w := tabwriter.NewWriter(os.Stdout, 8, 8, 8, ' ', 0)
defer func() {
// Ignore flushing errors - there's nothing we can do.
_ = w.Flush()
- 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 WatchMessageEvent
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func WatchMessageEvent(c Event) *WatchMessage_Event {
switch v := c.(type) {
case EventCreateNode:
return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Node{Node: v.Node}}}
case EventUpdateNode:
- 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 ConvertNodeWatch
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func ConvertNodeWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
var (
m Node
checkFuncs []NodeCheckFunc
hasRole bool
- 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 StoreSnapshot.Size
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func (m *StoreSnapshot) Size() (n int) {
if m == nil {
return 0
}
var l int
- 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 SubscribeLogsRequest.Unmarshal
has 23 return statements (exceeds 4 allowed). Open
func (m *SubscribeLogsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method ContainerSpec.CopyFrom
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func (m *ContainerSpec) CopyFrom(src interface{}) {
o := src.(*ContainerSpec)
*m = *o
if o.Labels != nil {
- 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 WatchMessage.Unmarshal
has 23 return statements (exceeds 4 allowed). Open
func (m *WatchMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method ContainerSpec.String
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (this *ContainerSpec) String() string {
if this == nil {
return "nil"
}
repeatedStringForMounts := "[]Mount{"
Method Orchestrator.reconcileOneNode
has 77 lines of code (exceeds 50 allowed). Consider refactoring. 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 parseTmpfs
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func parseTmpfs(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
if flags.Changed("tmpfs") {
tmpfss, err := flags.GetStringSlice("tmpfs")
if err != nil {
return err
Function skipHealth
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func skipHealth(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
Function skipCa
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func skipCa(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {