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()
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (c *RunContext) GetExportedEnv() []string {
if c.parent != nil {
return c.parent.GetExportedEnv()
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function setupRegistries
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context,
cfg *config.Config,
cleanup *Cleanup,
logger logging.Logger,
env []string,
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,
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,
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
}
Function setupLogger
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
cleanup *Cleanup,
scratch *scratch.ScratchSpace,
quiet bool,
verbose bool,
colorize bool,
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()
)
Function EnsureKeysAvailable
has 6 return statements (exceeds 4 allowed). Open
func EnsureKeysAvailable(identities []string) (bool, error) {
if len(identities) == 0 {
return false, nil
}
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,
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
}
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)
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
}
Function translateTask
has 6 return statements (exceeds 4 allowed). Open
func translateTask(
parent *config.Config,
name string,
data json.RawMessage,
) (config.Task, error) {
Method runner.run
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context,
args []string,
stdin io.ReadCloser,
outProcessor outputProcessor,
errProcessor outputProcessor,
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,
Function login
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context,
runner command.Runner,
server string,
username string,
password string,
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,
Method Transferer.transferPath
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
rawSrc string,
rawDest string,
srcRoot string,
destRoot string,
blacklist map[string]struct{},
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,