Showing 631 of 915 total issues
LocalStagesStorage
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
type LocalStagesStorage struct {
ContainerBackend container_backend.ContainerBackend
}
Function runExport
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func runExport(ctx context.Context, imagesToProcess build.ImagesToProcess) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method FullDockerfileStage.FetchDependencies
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func (s *FullDockerfileStage) FetchDependencies(ctx context.Context, c Conveyor, containerBackend container_backend.ContainerBackend, dockerRegistry docker_registry.GenericApiInterface) error {
resolvedDependenciesArgsHash := ResolveDependenciesArgs(s.targetPlatform, s.dependencies, c)
resolvedDockerMetaArgsHash, err := s.resolveDockerMetaArgs(resolvedDependenciesArgsHash)
if err != nil {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method FullDockerfileStage.GetDependencies
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func (s *FullDockerfileStage) GetDependencies(ctx context.Context, c Conveyor, cb container_backend.ContainerBackend, prevImage, prevBuiltImage *StageImage, buildContextArchive container_backend.BuildContextArchiver) (string, error) {
resolvedDependenciesArgsHash := ResolveDependenciesArgs(s.targetPlatform, s.dependencies, c)
resolvedDockerMetaArgsHash, err := s.resolveDockerMetaArgs(resolvedDependenciesArgsHash)
if err != nil {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
BaseStage
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
type BaseStage struct {
name StageName
logName string
targetPlatform string
imageName string
Function RunGC
has 145 lines of code (exceeds 50 allowed). Consider refactoring. Open
func RunGC(ctx context.Context, allowedVolumeUsagePercentage, allowedVolumeUsageMarginPercentage float64) error {
if lock, err := lockGC(ctx, false); err != nil {
return err
} else {
defer werf.ReleaseHostLock(lock)
Method Image.SetupBaseImage
has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring. Open
func (i *Image) SetupBaseImage(ctx context.Context, storageManager manager.StorageManagerInterface, storageOpts manager.StorageOptions) error {
logboek.Context(ctx).Debug().LogF(" -- SetupBaseImage for %q\n", i.Name)
switch i.baseImageType {
case StageAsBaseImage:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function runGetServiceValues
has 142 lines of code (exceeds 50 allowed). Consider refactoring. Open
func runGetServiceValues(ctx context.Context, imagesToProcess build.ImagesToProcess) error {
logboek.SetAcceptedLevel(level.Error)
if err := werf.Init(*getAutogeneratedValuedCmdData.TmpDir, *getAutogeneratedValuedCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
Method WerfChart.CreateNewBundle
has 142 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (wc *WerfChart) CreateNewBundle(ctx context.Context, destDir, chartVersion string, vals *values.Options) (*Bundle, error) {
chartPath := filepath.Join(wc.GiterminismManager.ProjectDir(), wc.ChartDir)
chrt, err := loader.LoadDir(chartPath)
if err != nil {
return nil, fmt.Errorf("error loading chart %q: %w", chartPath, err)
Function writePatch
has 140 lines of code (exceeds 50 allowed). Consider refactoring. Open
func writePatch(ctx context.Context, out io.Writer, gitDir, workTreeCacheDir string, withSubmodules bool, opts PatchOptions) (*PatchDescriptor, error) {
var err error
gitDir, err = filepath.Abs(gitDir)
if err != nil {
Function ReferencesToScan
has 137 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ReferencesToScan(ctx context.Context, gitRepository *git.Repository, keepPolicies []*config.MetaCleanupKeepPolicy) ([]*ReferenceToScan, error) {
rs, err := gitRepository.References()
if err != nil {
return nil, fmt.Errorf("get repository references failed: %w", err)
}
Method FullDockerfileStage.dockerfileInstructionDependencies
has 136 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *FullDockerfileStage) dockerfileInstructionDependencies(ctx context.Context, giterminismManager giterminism_manager.Interface, resolvedDockerMetaArgsHash, resolvedDependenciesArgsHash map[string]string, dockerStageID int, cmd interface{}, isOnbuildInstruction, isBaseImageOnbuildInstruction bool) ([]string, []string, error) {
var dependencies []string
var onBuildDependencies []string
resolveValueFunc := func(value string) (string, error) {
Function SecretEdit
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func SecretEdit(ctx context.Context, m *secrets_manager.SecretsManager, workingDir, filePath string, values bool) error {
var encoder *secret.YamlEncoder
if enc, err := m.GetYamlEncoder(ctx, workingDir); err != nil {
return err
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function NewCmd
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func NewCmd(ctx context.Context) (*cobra.Command, error) {
var namespace string
ctx = common.NewContextWithCmdData(ctx, &_commonCmdData)
cmd := common.SetCommandContext(ctx, &cobra.Command{
Use: "helm",
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method FileReader.walkFilesWithPathMatcher
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func (r FileReader) walkFilesWithPathMatcher(ctx context.Context, relDir string, pathMatcher path_matcher.PathMatcher, skipFileFunc func(ctx context.Context, r FileReader, existingRelPath string) (bool, error), fileFunc func(notResolvedPath string) error) error {
if !pathMatcher.IsDirOrSubmodulePathMatched(relDir) {
return nil
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function RunGC
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func RunGC(ctx context.Context, allowedVolumeUsagePercentage, allowedVolumeUsageMarginPercentage float64) error {
if lock, err := lockGC(ctx, false); err != nil {
return err
} else {
defer werf.ReleaseHostLock(lock)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function runCleanup
has 130 lines of code (exceeds 50 allowed). Consider refactoring. Open
func runCleanup(ctx context.Context) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Method StorageManager.FetchStage
has 129 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *StorageManager) FetchStage(ctx context.Context, containerBackend container_backend.ContainerBackend, stg stage.Interface) error {
logboek.Context(ctx).Debug().LogF("-- StagesManager.FetchStage %s\n", stg.LogDetailedName())
if err := m.LockStageImage(ctx, stg.GetStageImage().Image.Name()); err != nil {
return fmt.Errorf("error locking stage image %q: %w", stg.GetStageImage().Image.Name(), err)
Function run
has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring. Open
func run(ctx context.Context, pod, secret, namespace string, werfConfig *config.WerfConfig, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface) error {
projectName := werfConfig.Meta.Project
userExtraAnnotations, err := common.GetUserExtraAnnotations(&commonCmdData)
if err != nil {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run
has 124 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(ctx context.Context, pod, secret, namespace string, werfConfig *config.WerfConfig, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface) error {
projectName := werfConfig.Meta.Project
userExtraAnnotations, err := common.GetUserExtraAnnotations(&commonCmdData)
if err != nil {