Showing 68 of 96 total issues
File stagingacts.go
has 795 lines of code (exceeds 500 allowed). Consider refactoring. Open
package actions
import (
"fmt"
"github.com/SUSE/saptune/app"
Function SetForceLatency
has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring. Open
func SetForceLatency(value, savedStates string, revert bool) error {
oldState := ""
if !supportsForceLatencySettings(value) {
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 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
File serviceacts.go
has 676 lines of code (exceeds 500 allowed). Consider refactoring. Open
package actions
import (
"bytes"
"fmt"
Function GetCSP
has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring. Open
func GetCSP() string {
csp := ""
if _, err := os.Stat(dmiDir); os.IsNotExist(err) {
InfoLog("directory '%s' does not exist", dmiDir)
- 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 ParseINI
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func ParseINI(input string) *INIFile {
ret := &INIFile{
AllValues: make([]INIEntry, 0, 64),
KeyValue: make(map[string]map[string]INIEntry),
}
- 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 36 (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 ParseINI
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ParseINI(input string) *INIFile {
ret := &INIFile{
AllValues: make([]INIEntry, 0, 64),
KeyValue: make(map[string]map[string]INIEntry),
}
Function CompareNoteFields
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func CompareNoteFields(actualNote, expectedNote Note) (allMatch bool, comparisons map[string]FieldComparison, valApplyList []string) {
comparisons = make(map[string]FieldComparison)
allMatch = true
grubAvail := false
// Compare all fields
- 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
File app.go
has 531 lines of code (exceeds 500 allowed). Consider refactoring. Open
package app
import (
"fmt"
"github.com/SUSE/saptune/sap"
App
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type App struct {
SysconfigPrefix string
AllNotes map[string]note.Note // all notes
AllSolutions map[string]solution.Solution // all solutions
TuneForSolutions []string // list of solution names to tune, must always be sorted in ascending order.
Function SetLoginVal
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func SetLoginVal(key, value string, revert bool) error {
switch key {
case "UserTasksMax":
system.DebugLog("SetLoginVal - key is '%s', value is '%s', revert is '%v'\n", key, value, revert)
// because of systemd problems during shutting down a node,
- 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 OptServiceVal
has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring. Open
func OptServiceVal(key, cfgval string) string {
ssState := false
edState := false
retVal := ""
serviceKey := key
- 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
File solutionacts.go
has 514 lines of code (exceeds 500 allowed). Consider refactoring. Open
package actions
import (
"bufio"
"bytes"
Method INISettings.Optimise
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (vend INISettings) Optimise() (Note, error) {
blckOK := make(map[string][]string)
scheds := ""
next := false
Function GetCSP
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetCSP() string {
csp := ""
if _, err := os.Stat(dmiDir); os.IsNotExist(err) {
InfoLog("directory '%s' does not exist", dmiDir)
Function CheckRpmVers
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func CheckRpmVers(vers1, vers2 string) int {
// per definition numbers are greater than alphas
if vers1 == vers2 {
return 0
}
- 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 printNoteAndSols
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func printNoteAndSols(writer io.Writer, tuneApp *app.App, jstat *system.JStatus) bool {
notTuned := true
partial := false
fmt.Fprintf(writer, "enabled Solution: ")
solName := ""
Function main
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
system.InitOut(logSwitch)
if !system.ChkCliSyntax() {
actions.PrintHelpAndExit(os.Stdout, 1)
}
Method INISettings.Initialise
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (vend INISettings) Initialise() (Note, error) {
ini, err := txtparser.GetSectionInfo("sns", vend.ID, false)
if err != nil {
// Parse the configuration file
ini, err = txtparser.ParseINIFile(vend.ConfFilePath, false)