axamon/ramses

View on GitHub

Showing 5 of 6 total issues

Function elaboroRequest has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
Open

func elaboroRequest(ctx context.Context, result []interface{}, device string) {

    serieppptime, seriepppvalue := estraiSerie(result)

    // Se non ci sono abbastanza valori per la serie esce
Severity: Minor
Found in elaboroRequest.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 recuperaNAS has 69 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func recuperaNAS(ctx context.Context) (nasList [][]TNAS, err error) {

    //var bjson []byte

    username := configuration.IPDOMUser
Severity: Minor
Found in recuperanas.go - About 1 hr to fix

    Function clientRequest has 61 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func clientRequest(
        ctx context.Context, url, username, password, device string) (
        result []interface{}) {
    
        req, err := http.NewRequest("GET", url, nil)
    Severity: Minor
    Found in clientRequest.go - About 1 hr to fix

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

      func main() {
      
          // Creo il contesto inziale che verrà propagato alle go-routine
          // con la funzione cancel per uscire dal programma in modo pulito.
          ctx, cancel := context.WithCancel(context.Background())
      Severity: Minor
      Found in main.go - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                            if i > (numvalori - 6) {
                                mandamailAlert(configuration.SmtpFrom,
                                    configuration.SmtpTo,
                                    device, evento)
                                err := CreaTrap(device, "sessioni ppp", summary,
        Severity: Major
        Found in elaboroRequest.go - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language