Showing 107 of 107 total issues

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

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

                    func indexRuneWithEscaping(s string, r rune) int {
                        end := strings.IndexRune(s, r)
                        if end == -1 {
                            return -1
                        }
                    Severity: Minor
                    Found in server/pkg/publisher/publisher.go and 1 other location - About 40 mins to fix
                    server/pkg/gendocs/util.go on lines 57..70

                    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 111.

                    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

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

                    func indexRuneWithEscaping(s string, r rune) int {
                        end := strings.IndexRune(s, r)
                        if end == -1 {
                            return -1
                        }
                    Severity: Minor
                    Found in server/pkg/gendocs/util.go and 1 other location - About 40 mins to fix
                    server/pkg/publisher/publisher.go on lines 401..414

                    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 111.

                    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

                    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

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

                                  func NewCmdGenerateJekyll() *cobra.Command {
                                      cmd := &cobra.Command{
                                          Use:     "generate-jekyll",
                                          Short:   "Generate plugin path help as jekyll pages",
                                          Example: "vault-plugin-docs generate-jekyll",
                                  Severity: Major
                                  Found in server/cmd/vault-plugin-docs/main.go - About 40 mins to fix

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

                                    func removeCmd() *cobra.Command {
                                        cmd := &cobra.Command{
                                            Use:                   "remove REPO",
                                            Short:                 "Remove a software repository",
                                            DisableFlagsInUseLine: true,
                                    Severity: Major
                                    Found in client/cmd/trdl/remove.go - About 40 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language