Showing 614 of 901 total issues
cleanupManager
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
type cleanupManager struct {
stageManager stage_manager.Manager
nonexistentImportMetadataIDs []string
Function run
has 83 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(ctx context.Context, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface) error {
_, werfConfig, err := common.GetRequiredWerfConfig(ctx, &commonCmdData, giterminismManager, common.GetWerfConfigOptions(&commonCmdData, false))
if err != nil {
return fmt.Errorf("unable to load werf config: %w", err)
}
File helm_docs.go
has 513 lines of code (exceeds 500 allowed). Consider refactoring. Open
package helm
import "github.com/werf/werf/v2/cmd/werf/docs/structs"
func GetHelmCreateDocs() structs.DocsStruct {
Function NewCmd
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewCmd(ctx context.Context) *cobra.Command {
ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
cmd := common.SetCommandContext(ctx, &cobra.Command{
Use: "publish [IMAGE_NAME...]",
Short: "Publish bundle",
Function run
has 25 return statements (exceeds 4 allowed). Open
func run(ctx context.Context, imageName string) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Function runCleanup
has 25 return statements (exceeds 4 allowed). Open
func runCleanup(ctx context.Context) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Function run
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(ctx context.Context, imageName string) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Method api.getRepoImageByDesc
has 81 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (api *api) getRepoImageByDesc(ctx context.Context, originalTag string, desc *remote.Descriptor, ref name.Reference) (*image.Info, error) {
referenceParts, err := api.parseReferenceParts(ref.Name())
if err != nil {
return nil, fmt.Errorf("unable to parse reference %q: %w", ref.Name(), err)
}
Function NewExportCmd
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewExportCmd(ctx context.Context) *cobra.Command {
var tagTemplateList []string
var addLabelArray []string
ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
FileReader
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
func (r FileReader) projectRelativePathToAbsolutePath(relPath string) string {
return filepath.Join(r.sharedOptions.ProjectDir(), relPath)
}
GoroutineSafeBuffer
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
type GoroutineSafeBuffer struct {
*bytes.Buffer
m sync.Mutex
}
CallbackModule
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class CallbackModule(LiveCallbackHelpers):
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'stdout'
CALLBACK_NAME = 'live'
Function runMain
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func runMain(ctx context.Context) error {
global_warnings.PostponeMultiwerfNotUpToDateWarning()
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
Method cleanupManager.cleanupUnusedStages
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *cleanupManager) cleanupUnusedStages(ctx context.Context) error {
stageDescriptionList := m.stageManager.GetStageDescriptionList(stage_manager.StageDescriptionListOptions{})
stageDescriptionListCount := len(stageDescriptionList)
if err := logboek.Context(ctx).Info().LogProcess("Fetching imports metadata").DoError(func() error {
File kubectl.go
has 505 lines of code (exceeds 500 allowed). Consider refactoring. Open
package kubectl
import (
"fmt"
Function SecretEdit
has 78 lines of code (exceeds 50 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 {
Method cleanupManager.skipStageIDsThatAreUsedInKubernetes
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func (m *cleanupManager) skipStageIDsThatAreUsedInKubernetes(ctx context.Context, deployedDockerImages []*DeployedDockerImage) error {
handledDeployedStages := map[string]bool{}
handleTagFunc := func(tag, stageID string, f func()) {
dockerImageName := fmt.Sprintf("%s:%s", m.StorageManager.GetStagesStorage().Address(), tag)
for _, deployedDockerImage := range deployedDockerImages {
- 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 getStageDescription
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func getStageDescription(ctx context.Context, projectName string, stageID image.StageID, stagesStorage storage.StagesStorage, cacheStagesStorageList []storage.StagesStorage, opts getStageDescriptionOptions) (*image.StageDescription, error) {
if opts.WithLocalManifestCache {
stageDesc, err := getStageDescriptionFromLocalManifestCache(ctx, projectName, stageID, stagesStorage)
if err != nil {
return nil, fmt.Errorf("error getting stage %s description from %s: %w", stageID.String(), stagesStorage.String(), 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 WerfChart.CreateNewBundle
has 23 return statements (exceeds 4 allowed). 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)
Method commitHistoryScanner.handleCommit
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func (s *commitHistoryScanner) handleCommit(ctx context.Context, commit string) ([]string, error) {
var isReachedCommit bool
outerLoop:
for stageID, commitList := range s.expectedStageIDCommitList {
- 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"