Showing 333 of 526 total issues
Method CCache.writeCredential
has 109 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *CCache) writeCredential(cred *Credential, endian *binary.ByteOrder) ([]byte, error) {
var byteString bytes.Buffer
var err error
b := &byteString
Method Server.Get
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
func (svr *Server) Get(ctx context.Context, req *rpc.GetRequest) (*rpc.GetResponse, error) {
if svr.connect == nil || svr.connect.Context() == nil {
return nil, errors.New("not connected")
}
if svr.resourceLists == 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 Options.Dev
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (option *Options) Dev(ctx context.Context, cConfig *Config, hostConfig *HostConfig) error {
templateSpec, err := option.GetPodTemplateSpec()
if err != nil {
return err
}
Method ConnectOptions.PreCheckResource
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func (c *ConnectOptions) PreCheckResource() error {
if len(c.Workloads) == 0 {
return 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 Options.Dev
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func (option *Options) Dev(ctx context.Context, cConfig *Config, hostConfig *HostConfig) error {
templateSpec, err := option.GetPodTemplateSpec()
if 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
Function Parse
has 102 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*Config, *HostConfig, error) {
var (
attachStdin = copts.attach.Get("stdin")
attachStdout = copts.attach.Get("stdout")
attachStderr = copts.attach.Get("stderr")
Method CloneOptions.setEnv
has 102 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (d *CloneOptions) setEnv(u *unstructured.Unstructured) error {
temp, path, err := util.GetPodTemplateSpecPath(u)
if err != nil {
return err
}
Method Server.Clone
has 101 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (svr *Server) Clone(req *rpc.CloneRequest, resp rpc.Daemon_CloneServer) (err error) {
defer func() {
util.InitLoggerForServer(true)
log.SetOutput(svr.LogFile)
config.Debug = false
Function AddContainer
has 100 lines of code (exceeds 50 allowed). Consider refactoring. Open
func AddContainer(spec *corev1.PodSpec, c util.PodRouteConfig) {
// remove vpn container if already exist
RemoveContainer(spec)
spec.Containers = append(spec.Containers, corev1.Container{
Name: config.ContainerSidecarVPN,
ConnectOptions
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
type ConnectOptions struct {
Namespace string
Headers map[string]string
PortMap []string
Workloads []string
Function NewTunEndpoint
has 99 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewTunEndpoint(ctx context.Context, tun net.Conn, mtu uint32, engine config.Engine, in chan<- *DataElem, out chan *DataElem) stack.LinkEndpoint {
addr, _ := tcpip.ParseMACAddress("02:03:03:04:05:06")
endpoint := channel.New(tcp.DefaultReceiveBufferSize, mtu, addr)
go func() {
Method ConnectOptions.portForward
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func (c *ConnectOptions) portForward(ctx context.Context, portPair []string) error {
firstCtx, firstCancelFunc := context.WithCancel(ctx)
defer firstCancelFunc()
var errChan = make(chan error, 1)
go func() {
- 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 CCache.writeCredential
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func (c *CCache) writeCredential(cred *Credential, endian *binary.ByteOrder) ([]byte, error) {
var byteString bytes.Buffer
var err error
b := &byteString
- 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 TransferImage
has 96 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TransferImage(ctx context.Context, conf *SshConfig, imageSource, imageTarget string, out io.Writer) error {
client, cli, err := GetClient()
if err != nil {
log.Errorf("Failed to get docker client: %v", err)
return err
File docker_utils.go
has 533 lines of code (exceeds 500 allowed). Consider refactoring. Open
package dev
import (
"bytes"
"context"
Function PortMapUntil
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func PortMapUntil(ctx context.Context, conf *SshConfig, remote, local netip.AddrPort) error {
// Listen on remote server port
var lc net.ListenConfig
localListen, e := lc.Listen(ctx, "tcp", local.String())
if e != nil {
Function StartServer
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func StartServer(ctx context.Context, detach bool, remoteDir string) error {
if err := MakeSureGui(); err != nil {
return err
}
Method ConnectOptions.Cleanup
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (c *ConnectOptions) Cleanup() {
if c == nil {
return
}
- 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.Connect
has 93 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (svr *Server) Connect(req *rpc.ConnectRequest, resp rpc.Daemon_ConnectServer) (e error) {
defer func() {
util.InitLoggerForServer(true)
log.SetOutput(svr.LogFile)
config.Debug = false
CloneRequest
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type CloneRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields