Showing 614 of 901 total issues
Function getCommitMessages
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getCommitMessages() {
const { context } = github;
const ignoreTitle = core.getInput('ignoreTitle').trim() === 'true';
const ignoreDescription = core.getInput('ignoreDescription').trim() === 'true';
Function run
has 106 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)
}
Function prepareMultitrackSpec
has 106 lines of code (exceeds 50 allowed). Consider refactoring. Open
func prepareMultitrackSpec(metadataName, resourceNameOrKind, namespace string, annotations map[string]string, failuresCountOptions allowedFailuresCountOptions) (*multitrack.MultitrackSpec, error) {
defaultAllowFailuresCount := new(int)
// Allow 1 fail per replica by default
*defaultAllowFailuresCount = applyAllowedFailuresCountMultiplier(failuresCountOptions.defaultPerReplica, failuresCountOptions.multiplier)
Function NewCmd
has 105 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewCmd(ctx context.Context) *cobra.Command {
ctx = common.NewContextWithCmdData(ctx, &commonCmdData)
var useMsg string
if isSpecificImagesEnabled() {
Method api.mutateImageOrIndex
has 105 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (api *api) mutateImageOrIndex(ctx context.Context, imageOrIndex interface{}, mutateManifestConfigFunc func(cfg v1.Config) (v1.Config, error), ref name.Reference, isRefByDigest bool) (interface{}, error) {
switch i := imageOrIndex.(type) {
case v1.Image:
cf, err := i.ConfigFile()
if err != nil {
DockerServerBackend
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
type DockerServerBackend struct{}
Method ExtraAnnotationsAndLabelsPostRenderer.Run
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (pr *ExtraAnnotationsAndLabelsPostRenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, error) {
extraAnnotations := map[string]string{}
for k, v := range WerfRuntimeAnnotations {
extraAnnotations[k] = v
}
Function run
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func run(ctx context.Context, imagesToProcess build.ImagesToProcess, tagTemplateList []string, extraLabels map[string]string) error {
if imagesToProcess.WithoutImages {
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 run
has 35 return statements (exceeds 4 allowed). Open
func run(ctx context.Context, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface, imagesToProcess build.ImagesToProcess) error {
werfConfigPath, werfConfig, err := common.GetRequiredWerfConfig(ctx, &commonCmdData, giterminismManager, common.GetWerfConfigOptions(&commonCmdData, true))
if err != nil {
return fmt.Errorf("unable to load werf config: %w", err)
}
Method LegacyStageImage.Build
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func (i *LegacyStageImage) Build(ctx context.Context, options BuildOptions) error {
if i.GetTargetPlatform() == i.ContainerBackend.GetDefaultPlatform() && i.ContainerBackend.GetDefaultPlatform() != "linux/amd64" {
logboek.Context(ctx).Error().LogF("Detected your default build platform as %s.\n", i.ContainerBackend.GetDefaultPlatform())
logboek.Context(ctx).Error().LogF("Building of stapel-type images using Docker-Server backend for platforms other than linux/amd64 is not supported.\n")
logboek.Context(ctx).Error().LogF("Please either:\n * confirm emulation of linux/amd64 by exlicitly setting --platform=linux/amd64 param;\n * or use Dockerfile-type image instead.\n")
- 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 purge
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func purge(ctx context.Context, dryRun bool, containerBackend container_backend.ContainerBackend) error {
tmpFiles, err := ioutil.ReadDir(werf.GetTmpDir())
if err != nil {
return fmt.Errorf("unable to list tmp files in %s: %w", werf.GetTmpDir(), 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
Function SetupDockerfileStagesDependencies
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func SetupDockerfileStagesDependencies(stages []*DockerfileStage) error {
stageByName := make(map[string]*DockerfileStage)
for _, stage := range stages {
if stage.HasStageName() {
stageByName[strings.ToLower(stage.StageName)] = stage
- 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 GetLocalDockerServerStorageCheck
has 101 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetLocalDockerServerStorageCheck(ctx context.Context, dockerServerStoragePath string) (*LocalDockerServerStorageCheckResult, error) {
res := &LocalDockerServerStorageCheckResult{}
vu, err := volumeutils.GetVolumeUsageByPath(ctx, dockerServerStoragePath)
if err != nil {
LegacyStageImageContainer
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
type LegacyStageImageContainer struct {
image *LegacyStageImage
name string
runCommands []string
serviceRunCommands []string
NativeBuildah
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
type NativeBuildah struct {
Isolation thirdparty.Isolation
TmpDir string
InstanceTmpDir string
ConfigTmpDir string
Image
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
type Image struct {
CommonImageOptions
IsArtifact bool
IsDockerfileImage bool
Function RunGC
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func RunGC(ctx context.Context, dryRun bool, containerBackend container_backend.ContainerBackend) error {
projectDirsToRemove := []string{}
pathsToRemove := []string{}
if err := gcReleasedProjectDirs(&projectDirsToRemove, &pathsToRemove); 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 DoTasks
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func DoTasks(ctx context.Context, numberOfTasks int, options DoTasksOptions, taskFunc func(ctx context.Context, taskId int) error) error {
if numberOfTasks == 0 {
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 runGetServiceValues
has 32 return statements (exceeds 4 allowed). 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)
api
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
type api struct {
InsecureRegistry bool
SkipTlsVerifyRegistry bool
}