mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2025-01-18 07:51:40 +03:00
fix lint
This commit is contained in:
parent
761eea9795
commit
23981dad0c
@ -2,10 +2,10 @@ run:
|
||||
skip-dirs-use-default: true
|
||||
allow-parallel-runners: true
|
||||
modules-download-mode: readonly
|
||||
tests: false
|
||||
|
||||
output:
|
||||
format: colored-line-number
|
||||
formats:
|
||||
- format: colored-line-number
|
||||
sort-results: true
|
||||
|
||||
linters:
|
||||
@ -23,7 +23,7 @@ linters:
|
||||
- dupl
|
||||
- errorlint
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- copyloopvar
|
||||
- funlen
|
||||
- gocognit
|
||||
- goconst
|
||||
@ -32,7 +32,7 @@ linters:
|
||||
- godot
|
||||
- goimports
|
||||
- revive
|
||||
- gomnd
|
||||
- mnd
|
||||
- gosec
|
||||
- lll
|
||||
- makezero
|
||||
@ -162,7 +162,7 @@ issues:
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- dupl
|
||||
- gomnd
|
||||
- mnd
|
||||
- lll
|
||||
- bodyclose
|
||||
- errcheck
|
||||
|
@ -2,7 +2,6 @@ package logger
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
@ -108,8 +107,8 @@ func TestSkippedPath(t *testing.T) {
|
||||
require.True(t, ok)
|
||||
|
||||
for item, result := range items {
|
||||
assert.Equal(t, result, matcher.match(item), fmt.Sprintf(`"%s" does not match "%s", internals: %#v`,
|
||||
pattern, item, matcher))
|
||||
assert.Equal(t, result, matcher.match(item), `"%s" does not match "%s", internals: %#v`,
|
||||
pattern, item, matcher)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ type BufferedLogger interface {
|
||||
// // Some other code that works with logger.
|
||||
// fmt.Println(log.String())
|
||||
type BufferLogger struct {
|
||||
_ *zap.Logger
|
||||
logger.Default
|
||||
buf LockableBuffer
|
||||
}
|
||||
|
@ -33,35 +33,35 @@ func (t *BufferLoggerTest) Test_Read() {
|
||||
|
||||
data, err := io.ReadAll(t.logger)
|
||||
t.Require().NoError(err)
|
||||
t.Assert().Contains(string(data), "\"level_name\":\"DEBUG\"")
|
||||
t.Assert().Contains(string(data), "\"message\":\"test\"")
|
||||
t.Contains(string(data), "\"level_name\":\"DEBUG\"")
|
||||
t.Contains(string(data), "\"message\":\"test\"")
|
||||
|
||||
t.silentLogger.Debug("test")
|
||||
|
||||
data, err = io.ReadAll(t.silentLogger)
|
||||
t.Require().NoError(err)
|
||||
t.Assert().Contains(string(data), "\"level_name\":\"DEBUG\"")
|
||||
t.Assert().Contains(string(data), "\"message\":\"test\"")
|
||||
t.Contains(string(data), "\"level_name\":\"DEBUG\"")
|
||||
t.Contains(string(data), "\"message\":\"test\"")
|
||||
}
|
||||
|
||||
func (t *BufferLoggerTest) Test_Bytes() {
|
||||
t.logger.Debug("test")
|
||||
t.Assert().Contains(string(t.logger.Bytes()), "\"level_name\":\"DEBUG\"")
|
||||
t.Assert().Contains(string(t.logger.Bytes()), "\"message\":\"test\"")
|
||||
t.Contains(string(t.logger.Bytes()), "\"level_name\":\"DEBUG\"")
|
||||
t.Contains(string(t.logger.Bytes()), "\"message\":\"test\"")
|
||||
|
||||
t.silentLogger.Debug("test")
|
||||
t.Assert().Contains(string(t.silentLogger.Bytes()), "\"level_name\":\"DEBUG\"")
|
||||
t.Assert().Contains(string(t.silentLogger.Bytes()), "\"message\":\"test\"")
|
||||
t.Contains(string(t.silentLogger.Bytes()), "\"level_name\":\"DEBUG\"")
|
||||
t.Contains(string(t.silentLogger.Bytes()), "\"message\":\"test\"")
|
||||
}
|
||||
|
||||
func (t *BufferLoggerTest) Test_String() {
|
||||
t.logger.Debug("test")
|
||||
t.Assert().Contains(t.logger.String(), "\"level_name\":\"DEBUG\"")
|
||||
t.Assert().Contains(t.logger.String(), "\"message\":\"test\"")
|
||||
t.Contains(t.logger.String(), "\"level_name\":\"DEBUG\"")
|
||||
t.Contains(t.logger.String(), "\"message\":\"test\"")
|
||||
|
||||
t.silentLogger.Debug("test")
|
||||
t.Assert().Contains(t.silentLogger.String(), "\"level_name\":\"DEBUG\"")
|
||||
t.Assert().Contains(t.silentLogger.String(), "\"message\":\"test\"")
|
||||
t.Contains(t.silentLogger.String(), "\"level_name\":\"DEBUG\"")
|
||||
t.Contains(t.silentLogger.String(), "\"message\":\"test\"")
|
||||
}
|
||||
|
||||
func (t *BufferLoggerTest) TestRace() {
|
||||
|
@ -41,7 +41,7 @@ func (s *ValidatorSuite) getError(err error) string {
|
||||
}
|
||||
|
||||
func (s *ValidatorSuite) Test_ValidationInvalidType() {
|
||||
s.Assert().IsType(&validator.InvalidValidationError{}, s.engine.Struct(nil))
|
||||
s.IsType(&validator.InvalidValidationError{}, s.engine.Struct(nil))
|
||||
}
|
||||
|
||||
func (s *ValidatorSuite) Test_ValidationFails() {
|
||||
@ -62,7 +62,7 @@ func (s *ValidatorSuite) Test_ValidationFails() {
|
||||
err := s.engine.Struct(conn)
|
||||
s.Require().IsType(validator.ValidationErrors{}, err)
|
||||
|
||||
s.Assert().Equal(
|
||||
s.Equal(
|
||||
"Key: 'Connection.URL' Error:Field validation for 'URL' failed on the 'validateCrmURL' tag",
|
||||
s.getError(err))
|
||||
}
|
||||
@ -80,7 +80,7 @@ func (s *ValidatorSuite) Test_ValidationSuccess() {
|
||||
crmDomains = append(crmDomains, "https://"+domain.Domain)
|
||||
}
|
||||
|
||||
s.Assert().True(len(crmDomains) > 4, "No box domains were tested, test is incomplete!")
|
||||
s.Greater(len(crmDomains), 4, "No box domains were tested, test is incomplete!")
|
||||
|
||||
for _, domain := range crmDomains {
|
||||
conn := models.Connection{
|
||||
@ -89,6 +89,6 @@ func (s *ValidatorSuite) Test_ValidationSuccess() {
|
||||
}
|
||||
|
||||
err := s.engine.Struct(conn)
|
||||
s.Assert().NoError(err, domain+": "+s.getError(err))
|
||||
s.NoError(err, domain+": "+s.getError(err))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user