File stagingacts.go
has 796 lines of code (exceeds 500 allowed). Consider refactoring. Open
package actions
import (
"fmt"
"github.com/SUSE/saptune/app"
Function stagingActionRelease
has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring. Open
func stagingActionRelease(reader io.Reader, writer io.Writer, sObject []string) {
for _, sName := range sObject {
stagingFile := stgFiles.StageAttributes[sName]["sfilename"]
stageVers := stgFiles.StageAttributes[sName]["version"]
stageDate := stgFiles.StageAttributes[sName]["date"]
- 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 stagingActionRelease
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func stagingActionRelease(reader io.Reader, writer io.Writer, sObject []string) {
for _, sName := range sObject {
stagingFile := stgFiles.StageAttributes[sName]["sfilename"]
stageVers := stgFiles.StageAttributes[sName]["version"]
stageDate := stgFiles.StageAttributes[sName]["date"]
Function PrintStageFields
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func PrintStageFields(writer io.Writer, stageName string, comparison map[string]stageComparison) {
workFile := stgFiles.StageAttributes[stageName]["wfilename"]
headWork := fmt.Sprintf("Version %s (%s) ", txtparser.GetINIFileVersionSectionEntry(workFile, "version"), txtparser.GetINIFileVersionSectionEntry(workFile, "date"))
headStage := fmt.Sprintf("Version %s (%s) ", stgFiles.StageAttributes[stageName]["version"], stgFiles.StageAttributes[stageName]["date"])
- 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 printSolAnalysis
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func printSolAnalysis(writer io.Writer, stageName, txtPrefix, flag string) (bool, int) {
releaseable := true
retVal := 0
txtDeleteSol := "Deletion of %s\n"
txtSolNew := txtPrefix + "Solution is new, no action required.\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 printSolAnalysis
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func printSolAnalysis(writer io.Writer, stageName, txtPrefix, flag string) (bool, int) {
releaseable := true
retVal := 0
txtDeleteSol := "Deletion of %s\n"
txtSolNew := txtPrefix + "Solution is new, no action required.\n"
Function compareStageFields
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func compareStageFields(sName string, stage, work map[string]string) (allMatch bool, comparisons map[string]stageComparison) {
comparisons = make(map[string]stageComparison)
allMatch = true
// check for deleted Notes
if stgFiles.StageAttributes[sName]["deleted"] == "true" {
Function printNoteAnalysis
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func printNoteAnalysis(writer io.Writer, stageName, txtPrefix, flag string) (bool, int) {
releaseable := true
retVal := 0
txtDeleteNote := "Deletion of %s\n"
txtOverrideExists := txtPrefix + "Override file exists and might need adjustments.\n"