kubenetworks/kubevpn

View on GitHub

Showing 526 of 526 total issues

File daemon.pb.go has 3369 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
//     protoc-gen-go v1.33.0
//     protoc        v3.21.2
// source: daemon.proto
Severity: Major
Found in pkg/daemon/rpc/daemon.pb.go - About 1 wk to fix

    Function file_daemon_proto_init has 564 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func file_daemon_proto_init() {
        if File_daemon_proto != nil {
            return
        }
        if !protoimpl.UnsafeEnabled {
    Severity: Major
    Found in pkg/daemon/rpc/daemon.pb.go - About 2 days to fix

      Function file_daemon_proto_init has a Cognitive Complexity of 137 (exceeds 20 allowed). Consider refactoring.
      Open

      func file_daemon_proto_init() {
          if File_daemon_proto != nil {
              return
          }
          if !protoimpl.UnsafeEnabled {
      Severity: Minor
      Found in pkg/daemon/rpc/daemon.pb.go - About 2 days 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 createOutboundPod has 450 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func createOutboundPod(ctx context.Context, factory cmdutil.Factory, clientset *kubernetes.Clientset, namespace string) (err error) {
          innerIpv4CIDR := net.IPNet{IP: config.RouterIP, Mask: config.CIDR.Mask}
          innerIpv6CIDR := net.IPNet{IP: config.RouterIP6, Mask: config.CIDR6.Mask}
      
          service, err := clientset.CoreV1().Services(namespace).Get(ctx, config.ConfigMapPodTrafficManager, metav1.GetOptions{})
      Severity: Major
      Found in pkg/handler/remote.go - About 2 days to fix

        File daemon_grpc.pb.go has 1008 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
        // versions:
        // - protoc-gen-go-grpc v1.3.0
        // - protoc             v3.21.2
        // source: daemon.proto
        Severity: Major
        Found in pkg/daemon/rpc/daemon_grpc.pb.go - About 1 day to fix

          File connect.go has 996 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package handler
          
          import (
              "context"
              "encoding/json"
          Severity: Major
          Found in pkg/handler/connect.go - About 1 day to fix

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

            func (d *CloneOptions) setEnv(u *unstructured.Unstructured) error {
                temp, path, err := util.GetPodTemplateSpecPath(u)
                if err != nil {
                    return err
                }
            Severity: Minor
            Found in pkg/handler/clone.go - About 1 day 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 Config.watchServiceToAddHosts has a Cognitive Complexity of 83 (exceeds 20 allowed). Consider refactoring.
            Open

            func (c *Config) watchServiceToAddHosts(ctx context.Context, serviceInterface v13.ServiceInterface, hosts []Entry) {
                ticker := time.NewTicker(time.Second * 15)
                defer ticker.Stop()
                immediate := make(chan struct{}, 1)
                immediate <- struct{}{}
            Severity: Minor
            Found in pkg/dns/dns.go - About 1 day 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 SshJump has a Cognitive Complexity of 76 (exceeds 20 allowed). Consider refactoring.
            Open

            func SshJump(ctx context.Context, conf *SshConfig, flags *pflag.FlagSet, print bool) (path string, err error) {
                if conf.Addr == "" && conf.ConfigAlias == "" {
                    if flags != nil {
                        lookup := flags.Lookup("kubeconfig")
                        if lookup != nil {
            Severity: Minor
            Found in pkg/ssh/ssh.go - About 1 day 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

            File ssh.go has 810 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package ssh
            
            import (
                "bytes"
                "context"
            Severity: Major
            Found in pkg/ssh/ssh.go - About 1 day to fix

              Method CloneOptions.DoClone has 238 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (d *CloneOptions) DoClone(ctx context.Context, kubeconfigJsonBytes []byte) error {
                  var args []string
                  if len(d.Headers) != 0 {
                      args = append(args, "--headers", labels.Set(d.Headers).String())
                  }
              Severity: Major
              Found in pkg/handler/clone.go - About 1 day to fix

                File clone.go has 768 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package handler
                
                import (
                    "context"
                    "encoding/json"
                Severity: Major
                Found in pkg/handler/clone.go - About 1 day to fix

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

                  func (d *CloneOptions) DoClone(ctx context.Context, kubeconfigJsonBytes []byte) error {
                      var args []string
                      if len(d.Headers) != 0 {
                          args = append(args, "--headers", labels.Set(d.Headers).String())
                      }
                  Severity: Minor
                  Found in pkg/handler/clone.go - About 1 day 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 ConnectOptions.addExtraRoute has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (c *ConnectOptions) addExtraRoute(ctx context.Context, nameserver string) error {
                      if len(c.ExtraRouteInfo.ExtraDomain) == 0 {
                          return nil
                      }
                  
                  
                  Severity: Minor
                  Found in pkg/handler/connect.go - About 7 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 NewTunEndpoint has a Cognitive Complexity of 59 (exceeds 20 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() {
                  Severity: Minor
                  Found in pkg/core/gvisortunendpoint.go - About 6 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 SshJump has 186 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func SshJump(ctx context.Context, conf *SshConfig, flags *pflag.FlagSet, print bool) (path string, err error) {
                      if conf.Addr == "" && conf.ConfigAlias == "" {
                          if flags != nil {
                              lookup := flags.Lookup("kubeconfig")
                              if lookup != nil {
                  Severity: Major
                  Found in pkg/ssh/ssh.go - About 6 hrs to fix

                    Function CmdConnect has a Cognitive Complexity of 56 (exceeds 20 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: Minor
                    Found in cmd/kubevpn/cmds/connect.go - About 6 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 a Cognitive Complexity of 54 (exceeds 20 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: Minor
                    Found in pkg/daemon/action/disconnect.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 createOutboundPod has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func createOutboundPod(ctx context.Context, factory cmdutil.Factory, clientset *kubernetes.Clientset, namespace string) (err error) {
                        innerIpv4CIDR := net.IPNet{IP: config.RouterIP, Mask: config.CIDR.Mask}
                        innerIpv6CIDR := net.IPNet{IP: config.RouterIP6, Mask: config.CIDR6.Mask}
                    
                        service, err := clientset.CoreV1().Services(namespace).Get(ctx, config.ConfigMapPodTrafficManager, metav1.GetOptions{})
                    Severity: Minor
                    Found in pkg/handler/remote.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

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

                    func (c *ConnectOptions) addRouteDynamic(ctx context.Context) error {
                        tunName, e := c.GetTunDeviceName()
                        if e != nil {
                            return e
                        }
                    Severity: Minor
                    Found in pkg/handler/connect.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

                    Severity
                    Category
                    Status
                    Source
                    Language