SUSE/saptune

View on GitHub
app/app.go

Summary

Maintainability
C
1 day
Test Coverage
C
77%

File app.go has 530 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package app

import (
    "fmt"
    "github.com/SUSE/saptune/sap"
Severity: Minor
Found in app/app.go - About 2 hrs to fix

    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.
    Severity: Minor
    Found in app/app.go - About 2 hrs 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

        Method App.TuneNote has 9 return statements (exceeds 4 allowed).
        Open

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

          Method App.RevertNote has 5 return statements (exceeds 4 allowed).
          Open

          func (app *App) RevertNote(noteID string, permanent bool) error {
          
              noteTemplate, err := app.GetNoteByID(noteID)
              if err != nil {
                  // to revert an applied note even if the corresponding
          Severity: Major
          Found in app/app.go - About 35 mins to fix

            Method App.RevertSolution has 5 return statements (exceeds 4 allowed).
            Open

            func (app *App) RevertSolution(solName string) error {
                sol, err := app.GetSolutionByName(solName)
                if err != nil {
                    return err
                }
            Severity: Major
            Found in app/app.go - About 35 mins to fix

              Method App.VerifyNote has 5 return statements (exceeds 4 allowed).
              Open

              func (app *App) VerifyNote(noteID string) (conforming bool, comparisons map[string]note.FieldComparison, valApplyList []string, err error) {
                  theNote, err := app.GetNoteByID(noteID)
                  if err != nil {
                      return
                  }
              Severity: Major
              Found in app/app.go - About 35 mins to fix

                Method App.TuneSolution has 5 return statements (exceeds 4 allowed).
                Open

                func (app *App) TuneSolution(solName string) (removedExplicitNotes []string, err error) {
                    removedExplicitNotes = make([]string, 0)
                    sol, err := app.GetSolutionByName(solName)
                    if err != nil {
                        return
                Severity: Major
                Found in app/app.go - About 35 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status