Showing 614 of 901 total issues
PerfCheckContainerBackend
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
type PerfCheckContainerBackend struct {
ContainerBackend ContainerBackend
}
Function NewCmd
has 95 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: "kube-run [options] [IMAGE_NAME] [-- COMMAND ARG...]",
Short: "Run container for project image in Kubernetes",
Function run
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(ctx context.Context, containerBackend container_backend.ContainerBackend, giterminismManager giterminism_manager.Interface, commonCmdData common.CmdData, cmdData composeCmdData, dockerComposeCmdName string) error {
var envArray []string
if dockerComposeCmdName != "down" {
imagesToProcess := common.GetImagesToProcess(cmdData.WerfImagesToProcess, *commonCmdData.WithoutImages)
Function _get_task_info_from_args
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _get_task_info_from_args(self, task, start=False):
info = ''
if task.action in self.FREE_FORM_MODULES:
info = task.args.get('_raw_params', '')
if task.action == 'file':
- 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 93 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: "run [options] [IMAGE_NAME] [-- COMMAND ARG...]",
Short: "Run container for project image",
Function run
has 91 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(ctx context.Context, imageNames []string) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Function runDismiss
has 91 lines of code (exceeds 50 allowed). Consider refactoring. Open
func runDismiss(ctx context.Context) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Function NewCmd
has 90 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: "graph [IMAGE_NAME...]",
DisableFlagsInUseLine: true,
Function GetInfo
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func GetInfo(path string, firstTime bool) (info Info, err error) {
s := syscall.Statfs_t{}
err = syscall.Statfs(path, &s)
if err != nil {
return Info{}, 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 FileReader.resolveFilePath
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func (r FileReader) resolveFilePath(ctx context.Context, relPath string, depth int, checkSymlinkTargetFunc func(resolvedPath string) error) (string, error) {
if depth > 1000 {
return "", fmt.Errorf("too many levels of symbolic links")
}
depth++
- 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 a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
self.stdout_sock.listen(1)
rsockets = [self.stdout_sock]
while True:
- 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 89 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(ctx context.Context) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Function runRender
has 28 return statements (exceeds 4 allowed). Open
func runRender(ctx context.Context) error {
if err := werf.Init(*commonCmdData.TmpDir, *commonCmdData.HomeDir); err != nil {
return fmt.Errorf("initialization error: %w", err)
}
Manager
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
type Manager struct {
stages map[string]*stage
stageIDCustomTagList map[string][]string
finalStages map[string]*stage
imageMetadataList []*imageMetadata
FileReader
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
func (r FileReader) projectDirRelativePathToWorkTreeRelativePath(relPath string) string {
return filepath.Join(r.sharedOptions.RelativeToGitProjectDir(), relPath)
}
Function runMain
has 87 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.cleanupImageMetadata
has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring. Open
func (m *cleanupManager) cleanupImageMetadata(ctx context.Context, imageName string, hitStageIDCommitList map[string][]string, stageIDsToUnlink []string) error {
if countStageIDCommitList(hitStageIDCommitList) != 0 || len(stageIDsToUnlink) != 0 {
stageIDCommitListToDelete := map[string][]string{}
stageIDCommitListToCleanup := m.stageManager.GetStageIDCommitListToCleanup(imageName)
stageIDCommitListLoop:
- 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 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func newCmd(ctx context.Context, composeCmdName string, options *newCmdOptions) *cobra.Command {
var cmdData composeCmdData
var commonCmdData common.CmdData
short := GetComposeShort(composeCmdName).Short
Function NewCmd
has 84 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: "render [IMAGE_NAME...]",
Short: "Render Kubernetes templates",
Function NewNativeBuildah
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewNativeBuildah(commonOpts CommonBuildahOpts, opts NativeModeOpts) (*NativeBuildah, error) {
b := &NativeBuildah{
Isolation: *commonOpts.Isolation,
TmpDir: commonOpts.TmpDir,
Insecure: commonOpts.Insecure,