Skip to content

Commit

Permalink
Disabled revive linter
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-at-redhat authored and AaronH88 committed Mar 1, 2024
1 parent d002377 commit 107bd0f
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ linters:
# - paralleltest # TODO: missing at some locations
- prealloc
- predeclared
- revive
# - revive
- rowserrcheck
- sqlclosecheck
- staticcheck
Expand Down
2 changes: 1 addition & 1 deletion pkg/certificates/ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ rydzkVNNVeMVX2TER9yc8AdFqkRlaBWHmO61rYmV+N1quLM0uMVsu55ZNCY=
mockRsa := mock_certificates.NewMockRsaer(ctrl)

mockRsa.EXPECT().GenerateKey(gomock.Any(), gomock.Any()).DoAndReturn(
func(random io.Reader, bits int) (*rsa.PrivateKey, error) { //nolint:revive
func(random io.Reader, bits int) (*rsa.PrivateKey, error) {
return goodCaPrivateKey, nil
},
)
Expand Down
12 changes: 6 additions & 6 deletions pkg/controlsvc/controlsvc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestConnectionListener(t *testing.T) {
}

for _, testCase := range connectionListenerTestCases {
t.Run(testCase.name, func(t *testing.T) { //nolint:revive
t.Run(testCase.name, func(t *testing.T) {
ctx, ctxCancel := context.WithCancel(context.Background())
defer ctxCancel()

Expand Down Expand Up @@ -89,7 +89,7 @@ func TestSetupConnection(t *testing.T) {
}

for _, testCase := range setupConnectionTestCases {
t.Run(testCase.name, func(t *testing.T) { //nolint:revive
t.Run(testCase.name, func(t *testing.T) {
testCase.expectedCalls()
s := controlsvc.New(false, mockNetceptor)
tlsConn := tls.Client(mockConn, &tls.Config{})
Expand Down Expand Up @@ -452,7 +452,7 @@ func TestAddControlFunc(t *testing.T) {
{
name: "obliterate command",
input: "obliterate",
testCase: func(msg string, err error) { //nolint:revive
testCase: func(msg string, err error) {
if err != nil {
t.Errorf("error should be nil. received %s", err)
}
Expand All @@ -461,7 +461,7 @@ func TestAddControlFunc(t *testing.T) {
}

for _, testCase := range controlFuncTestsCases {
t.Run(testCase.name, func(t *testing.T) { //nolint:revive
t.Run(testCase.name, func(t *testing.T) {
s := controlsvc.New(true, mockNetceptor)
err := s.AddControlFunc(testCase.input, mockCtrlCmd)
testCase.testCase(testCase.errorMessage, err)
Expand Down Expand Up @@ -522,7 +522,7 @@ func TestRunControlSession(t *testing.T) {
}

for _, testCase := range runControlSessionTestCases {
t.Run(testCase.name, func(t *testing.T) { //nolint:revive
t.Run(testCase.name, func(t *testing.T) {
mandatoryExpects()
testCase.expectedCalls()
s := controlsvc.New(false, mockNetceptor)
Expand Down Expand Up @@ -592,7 +592,7 @@ func TestRunControlSessionTwo(t *testing.T) {
}

for _, testCase := range runControlSessionTestCases {
t.Run(testCase.name, func(t *testing.T) { //nolint:revive
t.Run(testCase.name, func(t *testing.T) {
testCase.expectedCalls()
s := controlsvc.New(true, mockNetceptor)
pipeA, pipeB := net.Pipe()
Expand Down
2 changes: 1 addition & 1 deletion pkg/controlsvc/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type (

var configPath = ""

var reloadParseAndRun = func(toRun []string) error { //nolint:revive
var reloadParseAndRun = func(toRun []string) error {
return fmt.Errorf("no configuration file was provided, reload function not set")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/netceptor/firewall_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func firewallRule(comparers []CompareFunc, action string) (FirewallRuleFunc, err
return nil, fmt.Errorf("unknown action: %s", action)
}
if len(comparers) == 0 {
return func(md *MessageData) FirewallResult { //nolint:revive
return func(md *MessageData) FirewallResult {
return result
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/netceptor/netceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ const (
func ReceptorVerifyFunc(tlscfg *tls.Config, pinnedFingerprints [][]byte, expectedHostname string,
expectedHostnameType ExpectedHostnameType, verifyType VerifyType, logger *logger.ReceptorLogger,
) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
return func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { //nolint:revive
return func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
if len(rawCerts) == 0 {
logger.Error("RVF failed: peer certificate missing")

Expand Down
2 changes: 1 addition & 1 deletion pkg/netceptor/packetconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestPacketConn(t *testing.T) {
{
"ReadFrom Error",
"",
func(ctx context.Context) { //nolint:revive
func(ctx context.Context) {
newCtx, ctxCancel := context.WithCancel(context.Background())
time.AfterFunc(time.Microsecond*200, ctxCancel)
mockNetceptorForPacketConn.EXPECT().Context().Return(newCtx)
Expand Down
6 changes: 3 additions & 3 deletions pkg/netceptor/tlsconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ FdaOLykGKfMCYVBP+xs97IJO8En/5N9QQwc+N4cfCg9/BWoZKHPbRx/V+57VEj0m
-----END CERTIFICATE-----
`))

return tempCertFile, tempCertKey, tempCA, func(t *testing.T) { //nolint:revive
return tempCertFile, tempCertKey, tempCA, func(t *testing.T) {
defer os.Remove(tempCertFile.Name())
defer os.Remove(tempCertKey.Name())
defer os.Remove(tempCA.Name())
Expand All @@ -162,7 +162,7 @@ func useUtilsSetupSuite(t *testing.T, name string) (string, string, string, func
t.Error(err.Error())
}

return ca, certKey, cert, func(t *testing.T) { //nolint:revive
return ca, certKey, cert, func(t *testing.T) {
defer os.Remove(ca)
defer os.Remove(certKey)
defer os.Remove(cert)
Expand All @@ -179,7 +179,7 @@ func useUtilsSetupSuiteWithGenerateWithCA(t *testing.T, name string) (string, st
t.Error(err.Error())
}

return caCert, cert, certKey, func(t *testing.T) { //nolint:revive
return caCert, cert, certKey, func(t *testing.T) {
defer os.Remove(caCert)
defer os.Remove(caKey)
defer os.Remove(certKey)
Expand Down
2 changes: 1 addition & 1 deletion pkg/workceptor/workceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (w *Workceptor) VerifySignature(signature string) error {
if err != nil {
return fmt.Errorf("could not load verifying key file: %s", err.Error())
}
token, err := jwt.ParseWithClaims(signature, &jwt.RegisteredClaims{}, func(token *jwt.Token) (interface{}, error) { //nolint:revive
token, err := jwt.ParseWithClaims(signature, &jwt.RegisteredClaims{}, func(token *jwt.Token) (interface{}, error) {
return rsaPublicKey, nil
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/workceptor/workceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestAllocateUnit(t *testing.T) {
logger := logger.NewReceptorLogger("")
mockNetceptor.EXPECT().GetLogger().AnyTimes().Return(logger)

workFunc := func(bwu workceptor.BaseWorkUnitForWorkUnit, w *workceptor.Workceptor, unitID string, workType string) workceptor.WorkUnit { //nolint:revive
workFunc := func(bwu workceptor.BaseWorkUnitForWorkUnit, w *workceptor.Workceptor, unitID string, workType string) workceptor.WorkUnit {
return mockWorkUnit
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/workceptor/workunitbase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func TestBaseLoad(t *testing.T) {
func TestBaseUpdateFullStatus(t *testing.T) {
ctrl, bwu, w, _ := setUp(t)
bwu.Init(w, "test", "", workceptor.FileSystem{}, &workceptor.RealWatcher{})
sf := func(sfd *workceptor.StatusFileData) { //nolint:revive
sf := func(sfd *workceptor.StatusFileData) {
// Do nothing
}
bwu.UpdateFullStatus(sf)
Expand Down

0 comments on commit 107bd0f

Please sign in to comment.