kubenetworks/kubevpn

View on GitHub

Showing 526 of 526 total issues

Method CopyOptions.Run has 7 return statements (exceeds 4 allowed).
Open

func (o *CopyOptions) Run() error {
    srcSpec, err := extractFileSpec(o.args[0])
    if err != nil {
        return err
    }
Severity: Major
Found in pkg/cp/cp.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

            if err != nil {
                return nil, err
            }
    Severity: Major
    Found in pkg/ssh/ssh.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      } else if lookup.DefValue != "" {
                          configFlags.KubeConfig = pointer.String(lookup.DefValue)
                      }
      Severity: Major
      Found in pkg/ssh/ssh.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                } else if code := status.Code(err); code == codes.AlreadyExists {
                    return fmt.Errorf("connect with cluster already established, disconnect required before proceeding")
                } else {
                    return err
                }
        Severity: Major
        Found in pkg/daemon/action/clone.go - About 45 mins to fix

          Method Manager.RentIP has 7 return statements (exceeds 4 allowed).
          Open

          func (m *Manager) RentIP(ctx context.Context) (*net.IPNet, *net.IPNet, error) {
              addrs, _ := net.InterfaceAddrs()
              var isAlreadyExistedFunc = func(ip net.IP) bool {
                  for _, addr := range addrs {
                      if addr == nil {
          Severity: Major
          Found in pkg/dhcp/dhcp.go - About 45 mins to fix

            Function PullImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func PullImage(ctx context.Context, platform *v1.Platform, cli *client.Client, dockerCli *command.DockerCli, img string, out io.Writer) error {
            Severity: Minor
            Found in pkg/ssh/image.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              } else if err != nil {
                                  log.Errorf("Receive from disconnect failed: %v", err)
                                  return err
                              }
              Severity: Major
              Found in pkg/daemon/action/proxy.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                        if err != nil {
                            return nil, err
                        }
                Severity: Major
                Found in pkg/ssh/ssh.go - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  } else if lookup.DefValue != "" {
                                      path = lookup.DefValue
                                  } else {
                                      path = lookup.NoOptDefVal
                                  }
                  Severity: Major
                  Found in pkg/ssh/ssh.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                } else if event.Op&fsnotify.Remove == fsnotify.Remove {
                                    notifyCh <- NotifyMessage{
                                        Operation: Remove,
                                        FilePath:  event.Name,
                                    }
                    Severity: Major
                    Found in pkg/controlplane/watcher.go - About 45 mins to fix

                      Method CCache.writePrincipal has 7 return statements (exceeds 4 allowed).
                      Open

                      func (c *CCache) writePrincipal(p principal, endian *binary.ByteOrder) ([]byte, error) {
                          var byteString bytes.Buffer
                          var err error
                      
                          b := &byteString
                      Severity: Major
                      Found in pkg/ssh/gssapi_ccache.go - About 45 mins to fix

                        Function NewTunEndpoint has 6 arguments (exceeds 4 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 {
                        Severity: Minor
                        Found in pkg/core/gvisortunendpoint.go - About 45 mins to fix

                          Method hijackedIOStreamer.stream has 7 return statements (exceeds 4 allowed).
                          Open

                          func (h *hijackedIOStreamer) stream(ctx context.Context) error {
                              restoreInput, err := h.setupInput()
                              if err != nil {
                                  return fmt.Errorf("unable to setup input stream: %s", err)
                              }
                          Severity: Major
                          Found in pkg/dev/docker_hijack.go - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if net.ParseIP(svc.Spec.ClusterIP) == nil {
                                                        continue
                                                    }
                            Severity: Major
                            Found in pkg/dns/dns.go - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if err != nil {
                                                          log.Errorf("Failed to add hosts(%s) to hosts: %v", entryList2String(appendHosts), err)
                                                      }
                              Severity: Major
                              Found in pkg/dns/dns.go - About 45 mins to fix

                                Function ParseProxyInfo has 7 return statements (exceeds 4 allowed).
                                Open

                                func ParseProxyInfo(conn net.Conn) (id stack.TransportEndpointID, err error) {
                                    var n int
                                    var port = make([]byte, 2)
                                
                                    // local port
                                Severity: Major
                                Found in pkg/core/gvisortcpforwarder.go - About 45 mins to fix

                                  Function transportTun has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func transportTun(ctx context.Context, tunInbound <-chan *DataElem, tunOutbound chan<- *DataElem, packetConn net.PacketConn, routeMapUDP *RouteMap, routeMapTCP *sync.Map) error {
                                  Severity: Minor
                                  Found in pkg/core/tunhandler.go - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if err != nil {
                                                                log.Errorf("Failed to remove hosts(%s) to hosts: %v", entryList2String(list), err)
                                                            }
                                    Severity: Major
                                    Found in pkg/dns/dns.go - About 45 mins to fix

                                      Method Config.CancelDNS has 7 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *Config) CancelDNS() {
                                          if cancel != nil {
                                              cancel()
                                          }
                                          dir := "/etc/resolver"
                                      Severity: Major
                                      Found in pkg/dns/dns_unix.go - About 45 mins to fix

                                        Identical blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                            for {
                                                resp, err = client.Recv()
                                                if err == io.EOF {
                                                    break
                                                } else if err == nil {
                                        Severity: Minor
                                        Found in cmd/kubevpn/cmds/quit.go and 1 other location - About 45 mins to fix
                                        cmd/kubevpn/cmds/proxy.go on lines 147..158

                                        Duplicated Code

                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                        Tuning

                                        This issue has a mass of 115.

                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                        Refactorings

                                        Further Reading

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language