docker/swarmkit

View on GitHub
ca/config.go

Summary

Maintainability
A
3 hrs
Test Coverage

Function ParseJoinToken has 6 return statements (exceeds 4 allowed).
Open

func ParseJoinToken(token string) (*ParsedJoinToken, error) {
    split := strings.Split(token, "-")
    numParts := len(split)

    // v1 has 4, v2 has 5
Severity: Major
Found in ca/config.go - About 40 mins to fix

    Function updateRootThenUpdateCert has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func updateRootThenUpdateCert(ctx context.Context, s *SecurityConfig, connBroker *connectionbroker.Broker, rootPaths CertPaths, failedCert *x509.Certificate) (*tls.Certificate, *IssuerInfo, error) {
    Severity: Minor
    Found in ca/config.go - About 35 mins to fix

      Method SecurityConfig.updateTLSCredentials has 5 return statements (exceeds 4 allowed).
      Open

      func (s *SecurityConfig) updateTLSCredentials(certificate *tls.Certificate, issuerInfo *IssuerInfo) error {
          certs := []tls.Certificate{*certificate}
          clientConfig, err := NewClientTLSConfig(certs, s.rootCA.Pool, ManagerRole)
          if err != nil {
              return errors.Wrap(err, "failed to create a new client config using the new root CA")
      Severity: Major
      Found in ca/config.go - About 35 mins to fix

        Function updateRootThenUpdateCert has 5 return statements (exceeds 4 allowed).
        Open

        func updateRootThenUpdateCert(ctx context.Context, s *SecurityConfig, connBroker *connectionbroker.Broker, rootPaths CertPaths, failedCert *x509.Certificate) (*tls.Certificate, *IssuerInfo, error) {
            if len(failedCert.Subject.OrganizationalUnit) == 0 || failedCert.Subject.OrganizationalUnit[0] != WorkerRole {
                return nil, nil, errors.New("cannot update root CA since this is not a worker")
            }
            // try downloading a new root CA if it's an unknown authority issue, in case there was a root rotation completion
        Severity: Major
        Found in ca/config.go - About 35 mins to fix

          Function DownloadRootCA has 5 return statements (exceeds 4 allowed).
          Open

          func DownloadRootCA(ctx context.Context, paths CertPaths, token string, connBroker *connectionbroker.Broker) (RootCA, error) {
              var rootCA RootCA
              // Get a digest for the optional CA hash string that we've been provided
              // If we were provided a non-empty string, and it is an invalid hash, return
              // otherwise, allow the invalid digest through.
          Severity: Major
          Found in ca/config.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status