Showing 348 of 348 total issues
Function NewPlanRunner
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context,
config *config.Config,
taskRunnerFactory TaskRunnerFactory,
logger logging.Logger,
env []string,
Function startContainer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
runID string,
containerName string,
scratch *scratch.ScratchSpace,
containerLists *ContainerLists,
logger logging.Logger,
Method Copier.copy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
src string,
dest string,
blacklist map[string]struct{},
info os.FileInfo,
recursive bool,
Function setupScratch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
runID string,
projectDir string,
scratchRoot string,
cleanup *Cleanup,
keepWorkspace bool,
Function startSSHAgent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
runID string,
identities []string,
scratch *scratch.ScratchSpace,
containerLists *ContainerLists,
logger logging.Logger,
Method StageRunner.buildTaskRunnerFunc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
stageTask *config.StageTask,
index int,
task config.Task,
context *RunContext,
ambiguous bool,
Function reportError
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context,
logger logging.Logger,
prefix *logging.Prefix,
format string,
args ...interface{},
Function newECRLogin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context,
logger logging.Logger,
env environment.Environment,
registry *config.ECRRegistry,
runner command.Runner,
Function newProcessor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
verbose bool,
colorize bool,
clock glock.Clock,
outStream io.Writer,
errStream io.Writer,
Similar blocks of code found in 2 locations. Consider refactoring. Open
func NewRemoveTaskRunnerFactory(
ctx context.Context,
logger logging.Logger,
) RemoveTaskRunnerFactory {
return func(
- 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 106.
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 NewPushTaskRunnerFactory(
ctx context.Context,
logger logging.Logger,
) PushTaskRunnerFactory {
return func(
- 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 106.
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
Method runTaskCommandBuilderState.addScriptOptions
has 5 return statements (exceeds 4 allowed). Open
func (s *runTaskCommandBuilderState) addScriptOptions(cb *command.Builder) error {
if s.task.Script == "" {
return nil
}
Function validateConfig
has 5 return statements (exceeds 4 allowed). Open
func validateConfig(path string, data []byte) error {
if err := schema.Validate("schema/config.yaml", data); err != nil {
return fmt.Errorf("failed to validate config %s: %s", path, err.Error())
}
Function runMain
has 5 return statements (exceeds 4 allowed). Open
func runMain() error {
app := kingpin.New("ij", "IJ is a build tool using Docker containers.").Version(consts.Version)
clean := app.Command("clean", "Remove exported files.")
_ = app.Command("login", "Login to docker registries.")
_ = app.Command("logout", "Logout of docker registries.")
Method ScratchSpace.MakeLogFiles
has 5 return statements (exceeds 4 allowed). Open
func (s *ScratchSpace) MakeLogFiles(prefix string) (*os.File, *os.File, error) {
outpath, err := buildPath(filepath.Join(s.runpath, LogsDir, prefix+OutLogSuffix))
if err != nil {
return nil, nil, err
}
Method runTaskCommandBuilderState.addCommandOptions
has 5 return statements (exceeds 4 allowed). Open
func (s *runTaskCommandBuilderState) addCommandOptions(cb *command.Builder) error {
if s.task.Script != "" {
return nil
}
Function getGCRPassword
has 5 return statements (exceeds 4 allowed). Open
func getGCRPassword(
env environment.Environment,
registry *config.GCRRegistry,
) (string, error) {
key, err := env.ExpandString(registry.Key)
Method Loader.Load
has 5 return statements (exceeds 4 allowed). Open
func (l *Loader) Load(path string) (*config.Config, error) {
path = l.normalizePath(path, "")
if err := l.readConfigs(path); err != nil {
return nil, err
Method runTaskRunner.exportEnvironmentFile
has 5 return statements (exceeds 4 allowed). Open
func (r *runTaskRunner) exportEnvironmentFile(context *RunContext, path string) bool {
workspace := r.scratch.Workspace()
realPath, err := filepath.Abs(filepath.Join(workspace, path))
if err != nil {
Function translateRegistry
has 5 return statements (exceeds 4 allowed). Open
func translateRegistry(data json.RawMessage) (config.Registry, error) {
typeHint := &RegistryTypeHint{Type: "server"}
if err := json.Unmarshal(data, typeHint); err != nil {
return nil, err