File fixtures.go
has 738 lines of code (exceeds 500 allowed). Consider refactoring. Open
// khan
// https://github.com/topfreegames/khan
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license
Function GetClanWithMemberships
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func GetClanWithMemberships(
db models.DB, approvedMemberships, deniedMemberships, bannedMemberships, pendingMemberships int, gameID string, clanPublicID string, options ...bool) (*models.Game, *models.Clan, *models.Player, []*models.Player, []*models.Membership, error) {
var game *models.Game
pendingsAreInvites := true
- 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 GetClanWithMemberships
has 143 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetClanWithMemberships(
db models.DB, approvedMemberships, deniedMemberships, bannedMemberships, pendingMemberships int, gameID string, clanPublicID string, options ...bool) (*models.Game, *models.Clan, *models.Player, []*models.Player, []*models.Membership, error) {
var game *models.Game
pendingsAreInvites := true
Function GetTestClanWithStaleData
has 98 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetTestClanWithStaleData(db models.DB, staleApplications, staleInvites, staleDenies, staleDeletes int) (string, error) {
gameID := uuid.NewV4().String()
game := GameFactory.MustCreateWithOption(map[string]interface{}{
"PublicID": gameID,
"Metadata": map[string]interface{}{
Function GetTestPlayerWithMemberships
has 98 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetTestPlayerWithMemberships(db models.DB, gameID string, approvedMemberships, rejectedMemberships, bannedMemberships, pendingMemberships int) (*models.Player, *models.Player, error) {
if gameID == "" {
gameID = uuid.NewV4().String()
}
game := GameFactory.MustCreateWithOption(map[string]interface{}{
Function GetClanReachedMaxMemberships
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetClanReachedMaxMemberships(db models.DB) (*models.Game, *models.Clan, *models.Player, []*models.Player, []*models.Membership, error) {
gameID := uuid.NewV4().String()
clanPublicID := uuid.NewV4().String()
game := GameFactory.MustCreateWithOption(map[string]interface{}{
Function GetTestPlayerWithMemberships
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func GetTestPlayerWithMemberships(db models.DB, gameID string, approvedMemberships, rejectedMemberships, bannedMemberships, pendingMemberships int) (*models.Player, *models.Player, error) {
if gameID == "" {
gameID = uuid.NewV4().String()
}
game := GameFactory.MustCreateWithOption(map[string]interface{}{
- 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 GetTestPlayerWithMemberships
has 13 return statements (exceeds 4 allowed). Open
func GetTestPlayerWithMemberships(db models.DB, gameID string, approvedMemberships, rejectedMemberships, bannedMemberships, pendingMemberships int) (*models.Player, *models.Player, error) {
if gameID == "" {
gameID = uuid.NewV4().String()
}
game := GameFactory.MustCreateWithOption(map[string]interface{}{
Function GetTestClanWithStaleData
has 8 return statements (exceeds 4 allowed). Open
func GetTestClanWithStaleData(db models.DB, staleApplications, staleInvites, staleDenies, staleDeletes int) (string, error) {
gameID := uuid.NewV4().String()
game := GameFactory.MustCreateWithOption(map[string]interface{}{
"PublicID": gameID,
"Metadata": map[string]interface{}{
Function GetClanWithMemberships
has 8 return statements (exceeds 4 allowed). Open
func GetClanWithMemberships(
db models.DB, approvedMemberships, deniedMemberships, bannedMemberships, pendingMemberships int, gameID string, clanPublicID string, options ...bool) (*models.Game, *models.Clan, *models.Player, []*models.Player, []*models.Membership, error) {
var game *models.Game
pendingsAreInvites := true
Function GetTestClanWithStaleData
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func GetTestClanWithStaleData(db models.DB, staleApplications, staleInvites, staleDenies, staleDeletes int) (string, error) {
gameID := uuid.NewV4().String()
game := GameFactory.MustCreateWithOption(map[string]interface{}{
"PublicID": gameID,
"Metadata": map[string]interface{}{
- 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 GetClanReachedMaxMemberships
has 7 return statements (exceeds 4 allowed). Open
func GetClanReachedMaxMemberships(db models.DB) (*models.Game, *models.Clan, *models.Player, []*models.Player, []*models.Membership, error) {
gameID := uuid.NewV4().String()
clanPublicID := uuid.NewV4().String()
game := GameFactory.MustCreateWithOption(map[string]interface{}{
Function CreateTestClans
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
db models.DB, mongoDB interfaces.MongoDB, gameID string, publicIDTemplate string, numberOfClans int, afterCreationHook AfterClanCreationHook,
Function CreateTestClans
has 6 return statements (exceeds 4 allowed). Open
func CreateTestClans(
db models.DB, mongoDB interfaces.MongoDB, gameID string, publicIDTemplate string, numberOfClans int, afterCreationHook AfterClanCreationHook,
) (*models.Player, []*models.Clan, error) {
if gameID == "" {
gameID = uuid.NewV4().String()
Function GetClanWithMemberships
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
db models.DB, approvedMemberships, deniedMemberships, bannedMemberships, pendingMemberships int, gameID string, clanPublicID string, options ...bool) (*models.Game, *models.Clan, *models.Player, []*models.Player, []*models.Membership, error) {
Your code does not pass gofmt in 3 places. Go fmt your code! Open
// khan
- Exclude checks