Showing 348 of 348 total issues

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

func (c *RunContext) GetTags() []string {
    if c.parent != nil {
        return c.parent.GetTags()
    }

Severity: Minor
Found in runner/context.go and 1 other location - About 45 mins to fix
runner/context.go on lines 79..93

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

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

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

func (c *RunContext) GetExportedEnv() []string {
    if c.parent != nil {
        return c.parent.GetExportedEnv()
    }

Severity: Minor
Found in runner/context.go and 1 other location - About 45 mins to fix
runner/context.go on lines 52..66

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

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 setupRegistries has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    ctx context.Context,
    cfg *config.Config,
    cleanup *Cleanup,
    logger logging.Logger,
    env []string,
Severity: Minor
Found in runner/setup.go - About 45 mins to fix

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

        ctx context.Context,
        logger logging.Logger,
        env environment.Environment,
        registries []config.Registry,
        factory loginFactory,
    Severity: Minor
    Found in registry/registry_set.go - About 45 mins to fix

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

          processor *processor,
          outStream io.Writer,
          outFile io.Writer,
          errStream io.Writer,
          errFile io.Writer,
      Severity: Minor
      Found in logging/logger.go - About 45 mins to fix

        Method Override.Translate has 7 return statements (exceeds 4 allowed).
        Open

        func (o *Override) Translate() (*config.Override, error) {
            options, err := o.Options.Translate()
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in loader/jsonconfig/override.go - About 45 mins to fix

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

              cleanup *Cleanup,
              scratch *scratch.ScratchSpace,
              quiet bool,
              verbose bool,
              colorize bool,
          Severity: Minor
          Found in runner/setup.go - About 45 mins to fix

            Method TaskExtendsResolver.resolve has 7 return statements (exceeds 4 allowed).
            Open

            func (r *TaskExtendsResolver) resolve(task Task) error {
                var (
                    name    = task.GetName()
                    extends = task.GetExtends()
                )
            Severity: Major
            Found in config/resolver.go - About 45 mins to fix

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

              func EnsureKeysAvailable(identities []string) (bool, error) {
                  if len(identities) == 0 {
                      return false, nil
                  }
              
              
              Severity: Major
              Found in ssh/keys.go - About 40 mins to fix

                Method Plan.AddStage has 6 return statements (exceeds 4 allowed).
                Open

                func (p *Plan) AddStage(stage *Stage) error {
                    if stage.BeforeStage != "" && stage.AfterStage != "" {
                        return fmt.Errorf(
                            "before_stage and after_stage declared in %s/%s",
                            p.Name,
                Severity: Major
                Found in config/plan.go - About 40 mins to fix

                  Method Loader.readOverride has 6 return statements (exceeds 4 allowed).
                  Open

                  func (l *Loader) readOverride(path string) (*config.Override, error) {
                      if override, ok := l.loadedOverrides[path]; ok {
                          return override, nil
                      }
                  
                  
                  Severity: Major
                  Found in loader/loader.go - About 40 mins to fix

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

                    func getAWSCredentials(
                        env environment.Environment,
                        registry *config.ECRRegistry,
                    ) (*awsCredentials, error) {
                        accessKeyID, err := env.ExpandString(registry.AccessKeyID)
                    Severity: Major
                    Found in registry/ecr.go - About 40 mins to fix

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

                      func copyFile(src, dest string, info os.FileInfo) error {
                          srcFile, err := os.Open(src)
                          if err != nil {
                              return err
                          }
                      Severity: Major
                      Found in paths/copier.go - About 40 mins to fix

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

                        func translateTask(
                            parent *config.Config,
                            name string,
                            data json.RawMessage,
                        ) (config.Task, error) {
                        Severity: Major
                        Found in loader/jsonconfig/task.go - About 40 mins to fix

                          Method runner.run has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              ctx context.Context,
                              args []string,
                              stdin io.ReadCloser,
                              outProcessor outputProcessor,
                              errProcessor outputProcessor,
                          Severity: Minor
                          Found in command/runner.go - About 35 mins to fix

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

                                ctx context.Context,
                                logger logging.Logger,
                                env environment.Environment,
                                registry *config.GCRRegistry,
                                runner command.Runner,
                            Severity: Minor
                            Found in registry/gcr.go - About 35 mins to fix

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

                                  ctx context.Context,
                                  runner command.Runner,
                                  server string,
                                  username string,
                                  password string,
                              Severity: Minor
                              Found in registry/registry.go - About 35 mins to fix

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

                                    command string,
                                    config *config.Config,
                                    appOptions *options.AppOptions,
                                    cleanOptions *options.CleanOptions,
                                    runOptions *options.RunOptions,
                                Severity: Minor
                                Found in subcommand/command.go - About 35 mins to fix

                                  Method Transferer.transferPath has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      rawSrc string,
                                      rawDest string,
                                      srcRoot string,
                                      destRoot string,
                                      blacklist map[string]struct{},
                                  Severity: Minor
                                  Found in paths/transferer.go - About 35 mins to fix

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

                                        ctx context.Context,
                                        logger logging.Logger,
                                        env environment.Environment,
                                        registry *config.ServerRegistry,
                                        runner command.Runner,
                                    Severity: Minor
                                    Found in registry/server.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language