topfreegames/khan

View on GitHub

Showing 425 of 425 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                It("If requestor does not have enough level", func() {
                    game, clan, _, players, memberships, err := fixtures.GetClanWithMemberships(testDb, 0, 0, 0, 2, "", "")
                    Expect(err).NotTo(HaveOccurred())

                    memberships[1].Level = "Member"
Severity: Major
Found in models/membership_test.go and 2 other locations - About 2 hrs to fix
models/membership_test.go on lines 2866..2885
models/membership_test.go on lines 2887..2906

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 230.

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

Further Reading

Function TransferOwnershipHandler has 91 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TransferOwnershipHandler(app *App) func(c echo.Context) error {
    return func(c echo.Context) error {
        c.Set("route", "TransferClanOwnership")
        start := time.Now()
        gameID := c.Param("gameID")
Severity: Major
Found in api/clan.go - About 2 hrs to fix

    Function LeaveClanHandler has 90 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func LeaveClanHandler(app *App) func(c echo.Context) error {
        return func(c echo.Context) error {
            c.Set("route", "LeaveClan")
            start := time.Now()
            gameID := c.Param("gameID")
    Severity: Major
    Found in api/clan.go - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func BenchmarkRetrieveClan(b *testing.B) {
          db, err := models.GetPerfDB()
          if err != nil {
              panic(err.Error())
          }
      Severity: Major
      Found in bench/clan_test.go and 1 other location - About 2 hrs to fix
      bench/clan_test.go on lines 127..152

      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 225.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func BenchmarkRetrieveClanSummary(b *testing.B) {
          db, err := models.GetPerfDB()
          if err != nil {
              panic(err.Error())
          }
      Severity: Major
      Found in bench/clan_test.go and 1 other location - About 2 hrs to fix
      bench/clan_test.go on lines 100..125

      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 225.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                      It("Membership is already denied", func() {
                          action := "approve"
                          game, clan, owner, players, memberships, err := fixtures.GetClanWithMemberships(testDb, 0, 0, 0, 1, "", "")
                          Expect(err).NotTo(HaveOccurred())
      
      
      Severity: Major
      Found in models/membership_test.go and 1 other location - About 2 hrs to fix
      models/membership_test.go on lines 2231..2254

      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 224.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                      It("Membership is already approved", func() {
                          action := "approve"
                          game, clan, owner, players, memberships, err := fixtures.GetClanWithMemberships(testDb, 0, 0, 0, 1, "", "")
                          Expect(err).NotTo(HaveOccurred())
      
      
      Severity: Major
      Found in models/membership_test.go and 1 other location - About 2 hrs to fix
      models/membership_test.go on lines 2256..2279

      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 224.

      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

      Further Reading

      Function easyjson91eb9988EncodeGithubComTopfreegamesKhanModels has 86 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func easyjson91eb9988EncodeGithubComTopfreegamesKhanModels(out *jwriter.Writer, in Clan) {
          out.RawByte('{')
          first := true
          _ = first
          {
      Severity: Major
      Found in models/clan_easyjson.go - About 2 hrs to fix

        Function UpdateClanHandler has 84 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func UpdateClanHandler(app *App) func(c echo.Context) error {
            return func(c echo.Context) error {
                c.Set("route", "UpdateClan")
                start := time.Now()
                gameID := c.Param("gameID")
        Severity: Major
        Found in api/clan.go - About 2 hrs to fix

          cacheImpl has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

              cacheImpl struct {
                  gameMaxMembers int
                  sharedClans    []sharedClan
                  freePlayers    *UnorderedStringMap
                  ownerPlayers   *UnorderedStringMap
          Severity: Minor
          Found in loadtest/cache.go - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            It("Player is already max level", func() {
                                action := "promote"
                                game, clan, owner, players, memberships, err := fixtures.GetClanWithMemberships(testDb, 0, 0, 0, 2, "", "")
                                Expect(err).NotTo(HaveOccurred())
            
            
            Severity: Major
            Found in models/membership_test.go and 1 other location - About 2 hrs to fix
            models/membership_test.go on lines 2656..2678

            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 210.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                Describe("getting a game by ID", func() {
                    It("Should get existing Game", func() {
                        game := fixtures.GameFactory.MustCreate().(*Game)
                        err := testDb.Insert(game)
                        Expect(err).NotTo(HaveOccurred())
            Severity: Major
            Found in models/game_test.go and 1 other location - About 2 hrs to fix
            models/game_test.go on lines 80..96

            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 210.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                Describe("getting game by ID", func() {
                    It("Should get existing Game", func() {
                        game := fixtures.GameFactory.MustCreate().(*Game)
                        err := testDb.Insert(game)
                        Expect(err).NotTo(HaveOccurred())
            Severity: Major
            Found in models/game_test.go and 1 other location - About 2 hrs to fix
            models/game_test.go on lines 98..114

            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 210.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            It("Player is already min level", func() {
                                action := "demote"
                                game, clan, owner, players, memberships, err := fixtures.GetClanWithMemberships(testDb, 0, 0, 0, 2, "", "")
                                Expect(err).NotTo(HaveOccurred())
            
            
            Severity: Major
            Found in models/membership_test.go and 1 other location - About 2 hrs to fix
            models/membership_test.go on lines 2600..2622

            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 210.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func getGamePayload(publicID, name string) map[string]interface{} {
                if publicID == "" {
                    publicID = randomdata.FullName(randomdata.RandomGender)
                }
                if name == "" {
            Severity: Major
            Found in bench/game_test.go and 1 other location - About 2 hrs to fix
            api/game_test.go on lines 25..48

            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 203.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func getGamePayload(publicID, name string) map[string]interface{} {
                if publicID == "" {
                    publicID = randomdata.FullName(randomdata.RandomGender)
                }
                if name == "" {
            Severity: Major
            Found in api/game_test.go and 1 other location - About 2 hrs to fix
            bench/game_test.go on lines 23..46

            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 203.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    if err != nil {
                        log.E(logger, "Could not dispatch membership hook by id", func(cm log.CM) {
                            cm.Write(zap.Error(err))
                        })
            
            
            Severity: Major
            Found in api/membership.go and 1 other location - About 2 hrs to fix
            api/membership.go on lines 218..234

            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 203.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    if err != nil {
                        log.E(logger, "Could not dispatch membership hook by id", func(cm log.CM) {
                            cm.Write(zap.Error(err))
                        })
            
            
            Severity: Major
            Found in api/membership.go and 1 other location - About 2 hrs to fix
            api/membership.go on lines 103..119

            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 203.

            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

            Further Reading

            Function UpdatePlayerHandler has 80 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func UpdatePlayerHandler(app *App) func(c echo.Context) error {
                return func(c echo.Context) error {
                    c.Set("route", "UpdatePlayer")
                    start := time.Now()
                    gameID := c.Param("gameID")
            Severity: Major
            Found in api/player.go - About 2 hrs to fix

              Function DeleteMembershipHandler has 80 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func DeleteMembershipHandler(app *App) func(c echo.Context) error {
                  return func(c echo.Context) error {
                      c.Set("route", "DeleteMembership")
                      start := time.Now()
                      clanPublicID := c.Param("clanPublicID")
              Severity: Major
              Found in api/membership.go - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language