Showing 8 of 16 total issues
RedisStore
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type RedisStore struct {
pool *redis.Pool // redis connection pool
tagSet *TagSet
prefix string
}
Route
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type Route struct {
inited bool
method []string
prefix string
Request
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type Request struct {
Request *http.Request
method string
path string
query map[string]string
Method Cookie.Set
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error) {
var cookie *http.Cookie
switch name.(type) {
case *http.Cookie:
Method Cookie.Set
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
Open
func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error) {
var cookie *http.Cookie
switch name.(type) {
case *http.Cookie:
- 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
Method Cookie.Set
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error) {
var cookie *http.Cookie
switch name.(type) {
case *http.Cookie:
Method RedisStore.Flush
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *RedisStore) Flush() error {
if s.tagSet != nil {
err := s.deleteForeverKeys()
if err != nil {
return err
Method RedisStore.deleteKeysByReference
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *RedisStore) deleteKeysByReference(reference string) error {
if s.tagSet == nil {
return nil
}