Showing 900 of 900 total issues
Method Local.Unshallow
has 5 return statements (exceeds 4 allowed). Open
func (repo *Local) Unshallow(ctx context.Context) error {
if lock, err := repo.acquireFetchLock(ctx); err != nil {
return fmt.Errorf("unable to acquire fetch lock: %w", err)
} else {
defer werf.ReleaseHostLock(lock)
Function DoTasks
has 5 return statements (exceeds 4 allowed). Open
func DoTasks(ctx context.Context, numberOfTasks int, options DoTasksOptions, taskFunc func(ctx context.Context, taskId int) error) error {
if numberOfTasks == 0 {
return nil
}
Function NewNativeStoreOptions
has 5 return statements (exceeds 4 allowed). Open
func NewNativeStoreOptions(rootlessUID int, driver StorageDriver) (*thirdparty.StoreOptions, error) {
var (
runRoot string
err error
)
Method NativeBuildah.Containers
has 5 return statements (exceeds 4 allowed). Open
func (b *NativeBuildah) Containers(ctx context.Context, opts ContainersOptions) (image.ContainerList, error) {
builders, err := buildah.OpenAllBuilders(b.Store)
if err != nil {
return nil, err
}
Method BuildContextArchive.Create
has 5 return statements (exceeds 4 allowed). Open
func (a *BuildContextArchive) Create(ctx context.Context, opts container_backend.BuildContextArchiveCreateOptions) error {
contextPathRelativeToGitWorkTree := filepath.Join(a.giterminismMgr.RelativeToGitProjectDir(), opts.ContextGitSubDir)
dockerIgnorePathMatcher, err := createDockerIgnorePathMatcher(ctx, a.giterminismMgr, opts.ContextGitSubDir, opts.DockerfileRelToContextPath)
if err != nil {
Function SetWerfFirstRunAt
has 5 return statements (exceeds 4 allowed). Open
func SetWerfFirstRunAt(ctx context.Context) error {
path := getWerfFirstRunAtPath()
if _, lock, err := AcquireHostLock(ctx, path, lockgate.AcquireOptions{OnWaitFunc: func(lockName string, doWait func() error) error { return doWait() }}); err != nil {
return fmt.Errorf("error locking path %q: %w", path, err)
} else {
Method container.RmIfExist
has 5 return statements (exceeds 4 allowed). Open
func (c *container) RmIfExist(ctx context.Context) error {
exist, err := docker.ContainerExist(ctx, c.Name)
if err != nil {
return err
}
Function InterfaceToStringArray
has 5 return statements (exceeds 4 allowed). Open
func InterfaceToStringArray(stringOrStringArray, configSection interface{}, doc *doc) ([]string, error) {
if stringOrStringArray == nil {
return []string{}, nil
} else if val, ok := stringOrStringArray.(string); ok {
return []string{val}, nil
Method WerfConfig.validateImageFrom
has 5 return statements (exceeds 4 allowed). Open
func (c *WerfConfig) validateImageFrom(i *StapelImageBase) error {
if i.raw.FromImage != "" {
fromImageName := i.raw.FromImage
if fromImageName == i.Name {
Method GitCacheStage.gitMappingsPatchSize
has 5 return statements (exceeds 4 allowed). Open
func (s *GitCacheStage) gitMappingsPatchSize(ctx context.Context, c Conveyor, prevBuiltImage *StageImage) (int64, error) {
var size int64
for _, gitMapping := range s.gitMappings {
commit, err := gitMapping.GetBaseCommitForPrevBuiltImage(ctx, c, prevBuiltImage)
if err != nil {
Method Image.setupBaseImageRepoDigest
has 5 return statements (exceeds 4 allowed). Open
func (i *Image) setupBaseImageRepoDigest(ctx context.Context, reference string) error {
i.Conveyor.GetServiceRWMutex("baseImagesRepoIdsCache" + reference).Lock()
defer i.Conveyor.GetServiceRWMutex("baseImagesRepoIdsCache" + reference).Unlock()
switch {
Method rawStapelImage.UnmarshalYAML
has 5 return statements (exceeds 4 allowed). Open
func (c *rawStapelImage) UnmarshalYAML(unmarshal func(interface{}) error) error {
parentStack.Push(c)
type plain rawStapelImage
err := unmarshal((*plain)(c))
parentStack.Pop()
Method rawStageDependencies.toDirective
has 5 return statements (exceeds 4 allowed). Open
func (c *rawStageDependencies) toDirective() (stageDependencies *StageDependencies, err error) {
stageDependencies = &StageDependencies{}
if install, err := InterfaceToStringArray(c.Install, c, c.rawGit.rawStapelImage.doc); err != nil {
return nil, err
Method WerfConfig.validateDependenciesImages
has 5 return statements (exceeds 4 allowed). Open
func (c *WerfConfig) validateDependenciesImages() error {
for _, dfImage := range c.ImagesFromDockerfile {
for _, imgDep := range dfImage.Dependencies {
if imgDep.ImageName == dfImage.Name {
return newDetailedConfigError(fmt.Sprintf("image can't depend on itself: `%s`!", imgDep.ImageName), imgDep.raw, dfImage.raw.doc)
Method _escStaticFS.prepare
has 5 return statements (exceeds 4 allowed). Open
func (_escStaticFS) prepare(name string) (*_escFile, error) {
f, present := _escData[path.Clean(name)]
if !present {
return nil, os.ErrNotExist
}
Function RunAutoHostCleanup
has 5 return statements (exceeds 4 allowed). Open
func RunAutoHostCleanup(ctx context.Context, options AutoHostCleanupOptions) error {
if !options.ForceShouldRun {
shouldRun, err := ShouldRunAutoHostCleanup(ctx, options.HostCleanupOptions)
if err != nil {
logboek.Context(ctx).Warn().LogF("WARNING: unable to check if auto host cleanup should be run: %s\n", err)
Method StapelImageBase.validate
has 5 return statements (exceeds 4 allowed). Open
func (c *StapelImageBase) validate(giterminismManager giterminism_manager.Interface) error {
if c.FromLatest {
if err := giterminismManager.Inspector().InspectConfigStapelFromLatest(); err != nil {
return newDetailedConfigError(err.Error(), nil, c.raw.doc)
}
Similar blocks of code found in 5 locations. Consider refactoring. Open
case *appsv1.DaemonSet:
// TODO: multiplier equals 3 because typically there are only 3 nodes in the cluster.
// TODO: It is better to fetch number of nodes dynamically, but in the most cases multiplier=3 will work ok.
spec, err := makeMultitrackSpec(ctx, &value.ObjectMeta, allowedFailuresCountOptions{multiplier: 3, defaultPerReplica: 1}, "ds")
if err != nil {
- 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 105.
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 5 locations. Consider refactoring. Open
case *extensions.DaemonSet:
// TODO: multiplier equals 3 because typically there are only 3 nodes in the cluster.
// TODO: It is better to fetch number of nodes dynamically, but in the most cases multiplier=3 will work ok.
spec, err := makeMultitrackSpec(ctx, &value.ObjectMeta, allowedFailuresCountOptions{multiplier: 3, defaultPerReplica: 1}, "ds")
if err != nil {
- 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 105.
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 5 locations. Consider refactoring. Open
case *batchv1.Job:
spec, err := makeMultitrackSpec(ctx, &value.ObjectMeta, allowedFailuresCountOptions{multiplier: 1, defaultPerReplica: 0}, "job")
if err != nil {
return nil, fmt.Errorf("cannot track %s %s: %w", value.Kind, value.Name, err)
}
- 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 105.
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