github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/revive.go (about)

     1  //golangcitest:args -Erevive
     2  //golangcitest:config_path testdata/configs/revive.yml
     3  package testdata
     4  
     5  import (
     6  	"net/http"
     7  	"time"
     8  )
     9  
    10  func SampleRevive(t *time.Duration) error {
    11  	if t == nil {
    12  		return nil
    13  	} else {
    14  		return nil
    15  	}
    16  }
    17  
    18  func testReviveComplexity(s string) { // want "cyclomatic: function testReviveComplexity has cyclomatic complexity 22"
    19  	if s == http.MethodGet || s == "2" || s == "3" || s == "4" || s == "5" || s == "6" || s == "7" {
    20  		return
    21  	}
    22  
    23  	if s == "1" || s == "2" || s == "3" || s == "4" || s == "5" || s == "6" || s == "7" {
    24  		return
    25  	}
    26  
    27  	if s == "1" || s == "2" || s == "3" || s == "4" || s == "5" || s == "6" || s == "7" {
    28  		return
    29  	}
    30  }