kubenetworks/kubevpn

View on GitHub

Showing 557 of 557 total issues

File daemon.pb.go has 3407 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 576 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 140 (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

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

      func (c *ConnectOptions) addRouteDynamic(ctx context.Context) (err error) {
          var tunName string
          tunName, err = c.GetTunDeviceName()
          if err != nil {
              return
      Severity: Minor
      Found in pkg/handler/connect.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 454 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 connect.go has 1101 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package handler
        
        import (
            "context"
            "fmt"
        Severity: Major
        Found in pkg/handler/connect.go - About 2 days to fix

          Method Config.AddServiceNameToHosts has a Cognitive Complexity of 107 (exceeds 20 allowed). Consider refactoring.
          Open

          func (c *Config) AddServiceNameToHosts(ctx context.Context, serviceInterface v13.ServiceInterface, hosts ...Entry) {
              rateLimiter := flowcontrol.NewTokenBucketRateLimiter(0.2, 1)
              defer rateLimiter.Stop()
          
              serviceList, err := serviceInterface.List(ctx, v1.ListOptions{})
          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

          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

            Function parse has a Cognitive Complexity of 96 (exceeds 20 allowed). Consider refactoring.
            Open

            func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*containerConfig, 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 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 docker_opts.go has 954 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package dev
            
            import (
                "bytes"
                "encoding/json"
            Severity: Major
            Found in pkg/dev/docker_opts.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

              Function parse has 331 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*containerConfig, error) {
                  var (
                      attachStdin  = copts.attach.Get("stdin")
                      attachStdout = copts.attach.Get("stdout")
                      attachStderr = copts.attach.Get("stderr")
              Severity: Major
              Found in pkg/dev/docker_opts.go - About 1 day to fix

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

                func (d *CloneOptions) DoClone(ctx context.Context, kubeconfigJsonBytes []byte) error {
                    for _, workload := range d.Workloads {
                        log.Infof("clone workload %s", workload)
                        object, err := util.GetUnstructuredObject(d.factory, d.Namespace, workload)
                        if err != nil {
                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

                Function SshJump has a Cognitive Complexity of 74 (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/util/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 remote.go has 748 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package handler
                
                import (
                    "bytes"
                    "context"
                Severity: Minor
                Found in pkg/handler/remote.go - About 7 hrs to fix

                  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

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

                  package util
                  
                  import (
                      "bytes"
                      "context"
                  Severity: Minor
                  Found in pkg/util/ssh.go - About 7 hrs to fix

                    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/tunendpoint.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 CloneOptions.DoClone has 185 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (d *CloneOptions) DoClone(ctx context.Context, kubeconfigJsonBytes []byte) error {
                        for _, workload := range d.Workloads {
                            log.Infof("clone workload %s", workload)
                            object, err := util.GetUnstructuredObject(d.factory, d.Namespace, workload)
                            if err != nil {
                    Severity: Major
                    Found in pkg/handler/clone.go - About 6 hrs to fix

                      Function SshJump has 182 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/util/ssh.go - About 6 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language