Showing 5 of 6 total issues
Function elaboroRequest
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
Open
func elaboroRequest(ctx context.Context, result []interface{}, device string) {
serieppptime, seriepppvalue := estraiSerie(result)
// Se non ci sono abbastanza valori per la serie esce
- 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 recuperaNAS
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func recuperaNAS(ctx context.Context) (nasList [][]TNAS, err error) {
//var bjson []byte
username := configuration.IPDOMUser
Function clientRequest
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func clientRequest(
ctx context.Context, url, username, password, device string) (
result []interface{}) {
req, err := http.NewRequest("GET", url, nil)
Function main
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
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())
Avoid deeply nested control flow statements. Open
Open
if i > (numvalori - 6) {
mandamailAlert(configuration.SmtpFrom,
configuration.SmtpTo,
device, evento)
err := CreaTrap(device, "sessioni ppp", summary,