Showing 614 of 901 total issues
Function NewUpgradeCmd
has 5 return statements (exceeds 4 allowed). Open
Open
func NewUpgradeCmd(actionConfig *action.Configuration, wc *chart_extender.WerfChartStub, namespace *string) *cobra.Command {
cmd, _ := helm_v3.NewUpgradeCmd(actionConfig, os.Stdout, helm_v3.UpgradeCmdOptions{
StagesSplitter: helm.NewStagesSplitter(),
StagesExternalDepsGenerator: helm.NewStagesExternalDepsGenerator(&actionConfig.RESTClientGetter, namespace),
ChainPostRenderer: wc.ChainPostRenderer,
Function sortResources
has 5 return statements (exceeds 4 allowed). Open
Open
func sortResources(id1, id2 *resrcid.ResourceID) bool {
kind1 := id1.GroupVersionKind().Kind
kind2 := id2.GroupVersionKind().Kind
if kind1 != kind2 {
return kind1 < kind2
Function NewExportCmd
has 5 return statements (exceeds 4 allowed). Open
Open
func NewExportCmd(ctx context.Context) *cobra.Command {
var tagTemplateList []string
var addLabelArray []string
ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
Function readEditedFile
has 5 return statements (exceeds 4 allowed). Open
Open
func readEditedFile(filePath string, values bool, encoder *secret.YamlEncoder) ([]byte, []byte, error) {
var data, encodedData []byte
exist, err := util.FileExists(filePath)
if err != nil {
Function GetStorageLockManager
has 5 return statements (exceeds 4 allowed). Open
Open
func GetStorageLockManager(ctx context.Context, synchronization *SynchronizationParams) (storage.LockManager, error) {
switch synchronization.SynchronizationType {
case LocalSynchronization:
return storage.NewGenericLockManager(werf.GetHostLocker()), nil
case KubernetesSynchronization:
Function getTelemetryProjectID
has 5 return statements (exceeds 4 allowed). Open
Open
func getTelemetryProjectID(ctx context.Context) (string, error) {
var projectID string
var workingDir, gitWorkTree string
Function createNamespace
has 5 return statements (exceeds 4 allowed). Open
Open
func createNamespace(ctx context.Context, namespace string) error {
if *commonCmdData.DryRun {
return nil
}
Function validateCopyTo
has 5 return statements (exceeds 4 allowed). Open
Open
func validateCopyTo() error {
rawCopyTo := getCopyToRaw()
for _, copyTo := range rawCopyTo {
parts := strings.Split(copyTo, ":")
Method cleanupManager.deleteUnusedCustomTags
has 5 return statements (exceeds 4 allowed). Open
Open
func (m *cleanupManager) deleteUnusedCustomTags(ctx context.Context) error {
stageIDCustomTagList := m.stageManager.GetCustomTagsMetadata()
if len(stageIDCustomTagList) == 0 {
return nil
}
Function GetCustomTagsMetadata
has 5 return statements (exceeds 4 allowed). Open
Open
func GetCustomTagsMetadata(ctx context.Context, storageManager manager.StorageManagerInterface) (map[string][]string, error) {
stageCustomTagMetadataIDs, err := storageManager.GetStagesStorage().GetStageCustomTagMetadataIDs(ctx, storage.WithCache())
if err != nil {
return nil, fmt.Errorf("unable to get stage custom tag metadata IDs: %w", err)
}
Function doRequest
has 5 return statements (exceeds 4 allowed). Open
Open
func doRequest(ctx context.Context, method, url string, body io.Reader, options doRequestOptions) (*http.Response, []byte, error) {
req, err := http.NewRequestWithContext(ctx, method, url, body)
if err != nil {
return nil, nil, err
}
Method StorageManager.SelectSuitableStage
has 5 return statements (exceeds 4 allowed). Open
Open
func (m *StorageManager) SelectSuitableStage(ctx context.Context, c stage.Conveyor, stg stage.Interface, stages []*image.StageDescription) (*image.StageDescription, error) {
if len(stages) == 0 {
return nil, nil
}
Function doFetchStage
has 5 return statements (exceeds 4 allowed). Open
Open
func doFetchStage(ctx context.Context, projectName string, stagesStorage storage.StagesStorage, stageID image.StageID, img container_backend.LegacyImageInterface) error {
err := logboek.Context(ctx).Info().LogProcess("Check manifest availability").DoError(func() error {
freshStageDescription, err := stagesStorage.GetStageDescription(ctx, projectName, stageID)
if err != nil {
return fmt.Errorf("unable to get stage description: %w", err)
Method api.PullImageArchive
has 5 return statements (exceeds 4 allowed). Open
Open
func (api *api) PullImageArchive(ctx context.Context, archiveWriter io.Writer, reference string) error {
ref, err := name.ParseReference(reference, api.parseReferenceOptions()...)
if err != nil {
return fmt.Errorf("unable to parse reference %q: %w", reference, err)
}
Method genericApi.mirrorReferenceList
has 5 return statements (exceeds 4 allowed). Open
Open
func (api *genericApi) mirrorReferenceList(ctx context.Context, reference string) ([]string, error) {
var referenceList []string
referenceParts, err := api.commonApi.parseReferenceParts(reference)
if err != nil {
Method BundleArchiveFileReader.ReadChartArchive
has 5 return statements (exceeds 4 allowed). Open
Open
func (reader *BundleArchiveFileReader) ReadChartArchive() ([]byte, error) {
treader, closer, err := reader.openForReading()
defer closer()
if err != nil {
Function GetRequiredSecretKey
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func GetRequiredSecretKey(workingDir string) ([]byte, error) {
var secretKey []byte
var werfSecretKeyPaths []string
var notFoundIn []string
- 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 readBundleJsonMap
has 5 return statements (exceeds 4 allowed). Open
Open
func readBundleJsonMap(path string) (map[string]string, error) {
var res map[string]string
if _, err := os.Stat(path); os.IsNotExist(err) {
return nil, nil
} else if err != nil {
Method BundleArchiveFileReader.ReadImageArchive
has 5 return statements (exceeds 4 allowed). Open
Open
func (reader *BundleArchiveFileReader) ReadImageArchive(imageTag string) (*ImageArchiveReadCloser, error) {
treader, closer, err := reader.openForReading()
if err != nil {
defer closer()
return nil, fmt.Errorf("unable to open bundle archive: %w", err)
Function detectImplementation
has 5 return statements (exceeds 4 allowed). Open
Open
func detectImplementation(accountOrRepositoryAddress string) (string, error) {
var parsedResource authn.Resource
var err error
parts := strings.SplitN(accountOrRepositoryAddress, "/", 2)