Showing 425 of 425 total issues
Function UpdateClanMembershipCount
has 6 return statements (exceeds 4 allowed). Open
func UpdateClanMembershipCount(db DB, id int64) error {
query := `
UPDATE clans SET membership_count=membership.count+1
FROM (
SELECT COUNT(*) as count
Function GetClanByPublicIDAndOwnerPublicID
has 6 return statements (exceeds 4 allowed). Open
func GetClanByPublicIDAndOwnerPublicID(db DB, gameID, publicID, ownerPublicID string) (*Clan, error) {
var clans []*Clan
var players []*Player
_, err := db.Select(&clans, "SELECT * FROM clans WHERE game_id=$1 AND public_id=$2", gameID, publicID)
if err != nil {
Similar blocks of code found in 3 locations. Consider refactoring. Open
log.I(logger, "Pruning stale data...", func(cm log.CM) {
cm.Write(
zap.String("GameID", options.GameID),
zap.Int("PendingApplicationsExpiration", options.PendingApplicationsExpiration),
zap.Int("PendingInvitesExpiration", options.PendingInvitesExpiration),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
log.I(cmdL, "Stale data for game pruned successfully.", func(cm log.CM) {
cm.Write(
zap.Int("PendingApplicationsPruned", stats.PendingApplicationsPruned),
zap.Int("PendingInvitesPruned", stats.PendingInvitesPruned),
zap.Int("DeniedMembershipsPruned", stats.DeniedMembershipsPruned),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
log.I(logger, "Pruned stale data succesfully.", func(cm log.CM) {
cm.Write(
zap.String("GameID", options.GameID),
zap.Int("PendingApplicationsPruned", stats.PendingApplicationsPruned),
zap.Int("PendingInvitesPruned", stats.PendingInvitesPruned),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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) {
Function UpdatePlayer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func UpdatePlayer(db DB, logger zap.Logger, encryptionKey []byte, gameID, publicID, name string, metadata map[string]interface{}) (*Player, error) {
Function validateUpdatePlayerDispatch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func validateUpdatePlayerDispatch(game *models.Game, sourcePlayer *models.Player, player *models.Player, metadata map[string]interface{}, logger zap.Logger) bool {
Function validateUpdateClanDispatch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func validateUpdateClanDispatch(game *models.Game, sourceClan *models.Clan, clan *models.Clan, metadata map[string]interface{}, logger zap.Logger) bool {
Method App.Rollback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (app *App) Rollback(tx gorp.Transaction, msg string, c echo.Context, logger zap.Logger, err error) error {
Function dispatchClanOwnershipChangeHook
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func dispatchClanOwnershipChangeHook(app *App, hookType int, clan *models.Clan, previousOwner *models.Player, newOwner *models.Player) error {
Function validateMembershipHookResponse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func validateMembershipHookResponse(apply map[string]interface{}, gameID string, clan *models.Clan, player *models.Player, requestor *models.Player) {
Function CreatePlayer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func CreatePlayer(db DB, logger zap.Logger, encryptionKey []byte, gameID, publicID, name string, metadata map[string]interface{}) (*Player, error) {
Method MongoWorker.updateClanIntoMongoDB
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx context.Context, gameID string, op string, clan map[string]interface{}, clanID string,
Function TransferClanOwnership
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func TransferClanOwnership(db DB, encryptionKey []byte, gameID, clanPublicID, playerPublicID string, levels map[string]interface{}, maxLevel int) (*Clan, *Player, *Player, error) {
Function createMembershipHelper
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func createMembershipHelper(db DB, gameID, level string, playerID, clanID, requestorID int64, message string, approved bool) (*Membership, error) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
func easyjsonA8a797f8EncodeGithubComTopfreegamesKhanApi11(out *jwriter.Writer, in ApproveOrDenyMembershipInvitationPayload) {
out.RawByte('{')
first := true
_ = first
{
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 106.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func easyjsonA8a797f8EncodeGithubComTopfreegamesKhanApi4(out *jwriter.Writer, in TransferClanOwnershipPayload) {
out.RawByte('{')
first := true
_ = first
{
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 106.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method Dispatcher.interpolateURL
has 5 return statements (exceeds 4 allowed). Open
func (d *Dispatcher) interpolateURL(sourceURL string, payload map[string]interface{}) (string, error) {
t, err := fasttemplate.NewTemplate(sourceURL, "{{", "}}")
if err != nil {
return sourceURL, err
}
Function PruneStaleData
has 5 return statements (exceeds 4 allowed). Open
func PruneStaleData(options *PruneOptions, db DB, logger zap.Logger) (*PruneStats, error) {
log.I(logger, "Pruning stale data...", func(cm log.CM) {
cm.Write(
zap.String("GameID", options.GameID),
zap.Int("PendingApplicationsExpiration", options.PendingApplicationsExpiration),