SUSE/saptune

View on GitHub

Showing 64 of 74 total issues

Function SolutionActionList has 65 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func SolutionActionList(writer io.Writer, tuneApp *app.App) {
    jsolutionList := []system.JSolListEntry{}
    jsolutionListEntry := system.JSolListEntry{}
    setColor := false
    fmt.Fprintf(writer, "\nAll solutions (* denotes enabled solution, O denotes override file exists for solution, C denotes custom solutions, D denotes deprecated solutions):\n")
Severity: Minor
Found in actions/solutionacts.go - About 1 hr to fix

    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"])
    Severity: Minor
    Found in actions/stagingacts.go - About 1 hr to fix

    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"
    Severity: Minor
    Found in actions/stagingacts.go - About 1 hr to fix

    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 GetFLInfo has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
    Open

    func GetFLInfo() (string, string, bool) {
        lat := 0
        maxlat := 0
        supported := false
        savedStates := ""
    Severity: Minor
    Found in system/cpu.go - About 1 hr to fix

    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 CheckRpmVers has 14 return statements (exceeds 4 allowed).
    Open

    func CheckRpmVers(vers1, vers2 string) int {
        // per definition numbers are greater than alphas
        if vers1 == vers2 {
            return 0
        }
    Severity: Major
    Found in system/rpm.go - About 1 hr to fix

      Function OptServiceVal has 57 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func OptServiceVal(key, cfgval string) string {
          ssState := false
          edState := false
          retVal := ""
          serviceKey := key
      Severity: Minor
      Found in sap/note/sectService.go - About 1 hr to fix

        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"
        Severity: Minor
        Found in actions/stagingacts.go - About 1 hr to fix

          Function GetSysSearchParam has 57 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func GetSysSearchParam(syskey string) (string, string) {
              searchParam := ""
              sect := ""
              // blkdev
              sched := regexp.MustCompile(`block.*queue\.scheduler$`)
          Severity: Minor
          Found in system/sys.go - About 1 hr to fix

            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" {
            Severity: Minor
            Found in actions/stagingacts.go - About 1 hr to fix

              Function CollectBlockDeviceInfo has 55 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func CollectBlockDeviceInfo() []string {
                  bdevConf := BlockDev{
                      AllBlockDevs:    make([]string, 0, 64),
                      BlockAttributes: make(map[string]map[string]string),
                  }
              Severity: Minor
              Found in system/blockdev.go - About 1 hr to fix

                Function WrapTxt has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func WrapTxt(text string, width int) (folded []string) {
                    var words []string
                    fallback := false
                
                    if strings.Contains(text, " ") {
                Severity: Minor
                Found in system/system.go - About 1 hr to fix

                  Function CheckRpmVers has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func CheckRpmVers(vers1, vers2 string) int {
                      // per definition numbers are greater than alphas
                      if vers1 == vers2 {
                          return 0
                      }
                  Severity: Minor
                  Found in system/rpm.go - About 1 hr to fix

                    Method App.TuneNote has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (app *App) TuneNote(noteID string) error {
                        savConf := false
                        aNote, err := app.GetNoteByID(noteID)
                        if err != nil {
                            return err
                    Severity: Minor
                    Found in app/app.go - About 1 hr to fix

                      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"
                      Severity: Minor
                      Found in actions/stagingacts.go - About 1 hr to fix

                        Function readVersionSection has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                        Confirmed

                        func readVersionSection(fileName string) ([]string, bool, error) {
                            skipSection := false
                            staging := false
                            chkVersEntries := map[string]bool{"missing": false, "found": false, "isNew": false, "isOld": false, "skip": false, "mandVers": false, "mandDate": false, "mandDesc": false, "mandRefs": false}
                            vsection := []string{}
                        Severity: Minor
                        Found in txtparser/section.go - About 1 hr to fix

                        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 WrapTxt has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func WrapTxt(text string, width int) (folded []string) {
                            var words []string
                            fallback := false
                        
                            if strings.Contains(text, " ") {
                        Severity: Minor
                        Found in system/system.go - About 1 hr to fix

                        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 getValidBlockDevices has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func getValidBlockDevices() (valDevs []string) {
                            var isMpath = regexp.MustCompile(`^mpath-\w+`)
                            var isLVM = regexp.MustCompile(`^LVM-\w+`)
                            candidates := []string{}
                            excludedevs := []string{}
                        Severity: Minor
                        Found in system/blockdev.go - About 1 hr to fix

                        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 GetFLInfo has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func GetFLInfo() (string, string, bool) {
                            lat := 0
                            maxlat := 0
                            supported := false
                            savedStates := ""
                        Severity: Minor
                        Found in system/cpu.go - About 1 hr to fix

                          Function OptBlkVal has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func OptBlkVal(key, cfgval string, cur *param.BlockDeviceQueue, bOK map[string][]string) (string, string) {
                              info := ""
                              if cfgval == "" {
                                  return cfgval, info
                              }
                          Severity: Minor
                          Found in sap/note/sectBlock.go - About 1 hr to fix

                            Function GetTuningOptions has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func GetTuningOptions(saptuneTuningDir, thirdPartyTuningDir string) TuningOptions {
                                ret := TuningOptions{}
                                // Collect those defined by saptune
                                _, files := system.ListDir(saptuneTuningDir, "saptune tuning definitions")
                                for _, fileName := range files {
                            Severity: Minor
                            Found in sap/note/note.go - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language