Showing 85 of 107 total issues

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

func objectSignaturesFromNotes(repo *git.Repository, objectID string) ([]string, error) {
    ref, err := repo.Reference(notesReferenceName, true)
    if err != nil {
        if err == plumbing.ErrReferenceNotFound {
            return nil, nil
Severity: Major
Found in server/pkg/git/signatures.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if len(artifactsTarStopReadCode) > codeCursor+1 {
                                codeCursor++
                            } else {
                                return nil
                            }
    Severity: Major
    Found in server/pkg/docker/image_build_response.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if len(artifactsTarStartReadCode) > codeCursor+1 {
                                  codeCursor++
      
                                  startReadCodeSuspectedBytes = append(startReadCodeSuspectedBytes, b)
                              } else {
      Severity: Major
      Found in server/pkg/docker/image_build_response.go - About 45 mins to fix

        Method Publisher.StageReleaseTarget has 7 return statements (exceeds 4 allowed).
        Open

        func (publisher *Publisher) StageReleaseTarget(ctx context.Context, repository RepositoryInterface, releaseName, releaseFilePath string, data io.Reader) error {
            publisher.mu.Lock()
            defer publisher.mu.Unlock()
        
            pathParts := SplitFilepath(filepath.Clean(releaseFilePath))
        Severity: Major
        Found in server/pkg/publisher/publisher.go - About 45 mins to fix

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

          func (m *Manager) cleanupTaskHistory(ctx context.Context, req *logical.Request) error {
              // define taskHistoryLimit
              taskHistoryLimit := fieldDefaultTaskHistoryLimit
              {
                  config, err := getConfiguration(ctx, req.Storage)
          Severity: Major
          Found in server/pkg/tasks_manager/periodic.go - About 45 mins to fix

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

            func ReadTarFromImageBuildResponse(tarWriter, buildLogWriter io.Writer, response types.ImageBuildResponse) error {
                dec := json.NewDecoder(response.Body)
                currentState := checkingStartCode
                var codeCursor int
                var bufferedData []byte
            Severity: Major
            Found in server/pkg/docker/image_build_response.go - About 45 mins to fix

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

              func buildReleaseArtifacts(ctx context.Context, tarWriter *nio.PipeWriter, gitRepo *git.Repository, fromImage string, runCommands []string, logger hclog.Logger) (error, func() error) {
              Severity: Minor
              Found in server/path_release.go - About 45 mins to fix

                Method Client.setup has 7 return statements (exceeds 4 allowed).
                Open

                func (c *Client) setup(rootVersion int64, rootSha512 string) error {
                    var rootBasename string
                    if rootVersion == 0 {
                        rootBasename = "root.json"
                    } else {
                Severity: Major
                Found in client/pkg/tuf/client.go - About 45 mins to fix

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

                  func addCmd() *cobra.Command {
                      cmd := &cobra.Command{
                          Use:                   "add REPO URL ROOT_VERSION ROOT_SHA512",
                          Short:                 "Add a software repository",
                          DisableFlagsInUseLine: true,
                  Severity: Major
                  Found in client/cmd/trdl/add.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        } else if _, err := buildLogWriter.Write([]byte{b}); err != nil {
                                            return fmt.Errorf("build log writer failed: %w", err)
                                        }
                    Severity: Major
                    Found in server/pkg/docker/image_build_response.go - About 45 mins to fix

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

                      func verifyObjectSignatures(repo *git.Repository, objectID string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
                          signatures, err := objectSignaturesFromNotes(repo, objectID)
                          if err != nil {
                              if strings.HasSuffix(err.Error(), plumbing.ErrObjectNotFound.Error()) {
                                  logger.Debug(fmt.Sprintf("[DEBUG-SIGNATURES] git object not found (%s): exiting", err))
                      Severity: Major
                      Found in server/pkg/git/signatures.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if _, err := buildLogWriter.Write(append(startReadCodeSuspectedBytes, b)); err != nil {
                                                    return fmt.Errorf("build log writer failed: %w", err)
                                                }
                        Severity: Major
                        Found in server/pkg/docker/image_build_response.go - About 45 mins to fix

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

                          func dirPathCmd() *cobra.Command {
                              cmd := &cobra.Command{
                                  Use:                   "dir-path REPO GROUP [CHANNEL]",
                                  Short:                 "Get the directory with software artifacts",
                                  DisableFlagsInUseLine: true,
                          Severity: Major
                          Found in client/cmd/trdl/dir_path.go - About 45 mins to fix

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

                            func execCmd() *cobra.Command {
                                cmd := &cobra.Command{
                                    Use:                   "exec REPO GROUP [CHANNEL] [BINARY_NAME] [--] [ARGS]",
                                    Short:                 "Exec a software binary",
                                    DisableFlagsInUseLine: true,
                            Severity: Major
                            Found in client/cmd/trdl/exec.go - About 40 mins to fix

                              Method Client.findChannelReleaseBinPath has 6 return statements (exceeds 4 allowed).
                              Open

                              func (c Client) findChannelReleaseBinPath(group, channel, optionalBinName string) (string, error) {
                                  dir, releaseName, err := c.findChannelReleaseBinDir(group, channel)
                                  if err != nil {
                                      return "", err
                                  }
                              Severity: Major
                              Found in client/pkg/repo/client.go - About 40 mins to fix

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

                                func setDefaultChannelCmd() *cobra.Command {
                                    cmd := &cobra.Command{
                                        Use:   "set-default-channel REPO CHANNEL",
                                        Short: "Set a default channel for a registered repository",
                                        Long: `Set a default channel for a registered repository.
                                Severity: Major
                                Found in client/cmd/trdl/set_default_channel.go - About 40 mins to fix

                                  Method Publisher.GetRepository has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (publisher *Publisher) GetRepository(ctx context.Context, storage logical.Storage, options RepositoryOptions) (RepositoryInterface, error) {
                                      publisher.mu.Lock()
                                      defer publisher.mu.Unlock()
                                  
                                      awsConfig := &aws.Config{
                                  Severity: Major
                                  Found in server/pkg/publisher/publisher.go - About 40 mins to fix

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

                                    func switchTaskToRunningInStorage(ctx context.Context, storage logical.Storage, uuid string) error {
                                        // get previous task state from storage
                                        var prevTask *Task
                                        {
                                            t, err := getTaskFromStorage(ctx, storage, taskStateQueued, uuid)
                                    Severity: Major
                                    Found in server/pkg/tasks_manager/task.go - About 40 mins to fix

                                      Method Client.initTufClient has 6 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *Client) initTufClient() error {
                                          localDB, err := leveldbstore.FileLocalStore(c.metaLocalStoreDir)
                                          if err != nil {
                                              return fmt.Errorf("unable to init file local store: %w", err)
                                          }
                                      Severity: Major
                                      Found in client/pkg/tuf/client.go - About 40 mins to fix

                                        Method Client.CleanReleases has 6 return statements (exceeds 4 allowed).
                                        Open

                                        func (c Client) CleanReleases() error {
                                            actualLocalReleases, err := c.getActualLocalReleases()
                                            if err != nil {
                                                return fmt.Errorf("unable to get actual local releases: %w", err)
                                            }
                                        Severity: Major
                                        Found in client/pkg/repo/clean_releases.go - About 40 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language