kubenetworks/kubevpn

View on GitHub

Showing 526 of 526 total issues

Method CloneOptions.setVolume has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
Open

func (d *CloneOptions) setVolume(u *unstructured.Unstructured) error {

    const TokenVolumeMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"

    type VolumeMountContainerPair struct {
Severity: Minor
Found in pkg/handler/clone.go - About 5 hrs to fix

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 PortMapUntil has a Cognitive Complexity of 51 (exceeds 20 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 {
Severity: Minor
Found in pkg/ssh/ssh.go - About 5 hrs to fix

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 CmdProxy has 149 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func CmdProxy(f cmdutil.Factory) *cobra.Command {
    var connect = handler.ConnectOptions{}
    var extraRoute = &handler.ExtraRouteInfo{}
    var sshConf = &pkgssh.SshConfig{}
    var transferImage, foreground bool
Severity: Major
Found in cmd/kubevpn/cmds/proxy.go - About 4 hrs to fix

    Function CmdCp has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func CmdCp(f cmdutil.Factory) *cobra.Command {
        o := cp.NewCopyOptions(genericiooptions.IOStreams{
            In:     os.Stdin,
            Out:    os.Stdout,
            ErrOut: os.Stderr,
    Severity: Minor
    Found in cmd/kubevpn/cmds/cp.go - About 4 hrs to fix

    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 CmdConnect has 139 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func CmdConnect(f cmdutil.Factory) *cobra.Command {
        var connect = &handler.ConnectOptions{}
        var extraRoute = &handler.ExtraRouteInfo{}
        var sshConf = &pkgssh.SshConfig{}
        var transferImage, foreground, lite bool
    Severity: Major
    Found in cmd/kubevpn/cmds/connect.go - About 4 hrs to fix

      Method CloneOptions.setVolume has 136 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (d *CloneOptions) setVolume(u *unstructured.Unstructured) error {
      
          const TokenVolumeMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"
      
          type VolumeMountContainerPair struct {
      Severity: Major
      Found in pkg/handler/clone.go - About 4 hrs to fix

        Function CmdClone has 136 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func CmdClone(f cmdutil.Factory) *cobra.Command {
            var options = handler.CloneOptions{}
            var sshConf = &pkgssh.SshConfig{}
            var extraRoute = &handler.ExtraRouteInfo{}
            var transferImage bool
        Severity: Major
        Found in cmd/kubevpn/cmds/clone.go - About 4 hrs to fix

          Function Parse has a Cognitive Complexity of 44 (exceeds 20 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")
          Severity: Minor
          Found in pkg/dev/docker_opts.go - About 4 hrs to fix

          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 recursiveTar has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
          Open

          func recursiveTar(srcDir, srcFile localPath, destDir, destFile remotePath, tw *tar.Writer) error {
              matchedPaths, err := srcDir.Join(srcFile).Glob()
              if err != nil {
                  return err
              }
          Severity: Minor
          Found in pkg/cp/cp.go - About 4 hrs to fix

          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 AddMeshContainer has 123 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func AddMeshContainer(spec *v1.PodTemplateSpec, nodeId string, c util.PodRouteConfig) {
              // remove envoy proxy containers if already exist
              RemoveContainers(spec)
          
              envoyLogLevel := "error"
          Severity: Major
          Found in pkg/inject/controller.go - About 3 hrs to fix

            Function ToListener has 123 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func ToListener(listenerName string, routeName string, port int32, p corev1.Protocol) *listener.Listener {
                var protocol core.SocketAddress_Protocol
                switch p {
                case corev1.ProtocolTCP:
                    protocol = core.SocketAddress_TCP
            Severity: Major
            Found in pkg/controlplane/cache.go - About 3 hrs to fix

              Function CmdProxy has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
              Open

              func CmdProxy(f cmdutil.Factory) *cobra.Command {
                  var connect = handler.ConnectOptions{}
                  var extraRoute = &handler.ExtraRouteInfo{}
                  var sshConf = &pkgssh.SshConfig{}
                  var transferImage, foreground bool
              Severity: Minor
              Found in cmd/kubevpn/cmds/proxy.go - About 3 hrs to fix

              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.Proxy has 121 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (svr *Server) Proxy(req *rpc.ConnectRequest, resp rpc.Daemon_ProxyServer) (e error) {
                  defer func() {
                      util.InitLoggerForServer(true)
                      log.SetOutput(svr.LogFile)
                      config.Debug = false
              Severity: Major
              Found in pkg/daemon/action/proxy.go - About 3 hrs to fix

                Method ConnectOptions.addExtraRoute has 120 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *ConnectOptions) addExtraRoute(ctx context.Context, nameserver string) error {
                    if len(c.ExtraRouteInfo.ExtraDomain) == 0 {
                        return nil
                    }
                
                
                Severity: Major
                Found in pkg/handler/connect.go - About 3 hrs to fix

                  Method Server.Proxy has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (svr *Server) Proxy(req *rpc.ConnectRequest, resp rpc.Daemon_ProxyServer) (e error) {
                      defer func() {
                          util.InitLoggerForServer(true)
                          log.SetOutput(svr.LogFile)
                          config.Debug = false
                  Severity: Minor
                  Found in pkg/daemon/action/proxy.go - About 3 hrs to fix

                  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 handle has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func handle(ctx context.Context, tcpConn net.Conn, udpConn *net.UDPConn) {
                      defer udpConn.Close()
                      log.Debugf("[TUN-UDP] %s <-> %s", tcpConn.RemoteAddr(), udpConn.LocalAddr())
                      errChan := make(chan error, 2)
                      go func() {
                  Severity: Minor
                  Found in pkg/core/gvisorudphandler.go - About 3 hrs to fix

                  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 CmdDev has 116 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func CmdDev(f cmdutil.Factory) *cobra.Command {
                      var options = &dev.Options{
                          NoProxy:        false,
                          ExtraRouteInfo: handler.ExtraRouteInfo{},
                      }
                  Severity: Major
                  Found in cmd/kubevpn/cmds/dev.go - About 3 hrs to fix

                    Method ConnectOptions.getCIDR has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (c *ConnectOptions) getCIDR(ctx context.Context, m *dhcp.Manager) (err error) {
                        defer func() {
                            if err == nil {
                                u, err2 := url.Parse(c.config.Host)
                                if err2 != nil {
                    Severity: Minor
                    Found in pkg/handler/connect.go - About 3 hrs to fix

                    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 CmdDev has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func CmdDev(f cmdutil.Factory) *cobra.Command {
                        var options = &dev.Options{
                            NoProxy:        false,
                            ExtraRouteInfo: handler.ExtraRouteInfo{},
                        }
                    Severity: Minor
                    Found in cmd/kubevpn/cmds/dev.go - About 3 hrs to fix

                    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.Disconnect has 110 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (svr *Server) Disconnect(req *rpc.DisconnectRequest, resp rpc.Daemon_DisconnectServer) error {
                        defer func() {
                            util.InitLoggerForServer(true)
                            log.SetOutput(svr.LogFile)
                            config.Debug = false
                    Severity: Major
                    Found in pkg/daemon/action/disconnect.go - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language