tuna-timer/tuna-timer-api

View on GitHub

Showing 37 of 37 total issues

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

func (s *TimerRepositoryTestSuite) SetUpSuite() {
    e := utils.NewEnvironment(utils.TestEnv, "1.0.0")

    session, err := utils.ConnectToDatabase(e.Config)
    if err != nil {
Severity: Major
Found in data/timer_repository_test.go and 2 other locations - About 1 hr to fix
data/team_repository_test.go on lines 125..138
data/user_repository_test.go on lines 101..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 129.

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 3 locations. Consider refactoring.
Open

func (s *UserRepositoryTestSuite) SetUpSuite() {
    e := utils.NewEnvironment(utils.TestEnv, "1.0.0")

    session, err := utils.ConnectToDatabase(e.Config)
    if err != nil {
Severity: Major
Found in data/user_repository_test.go and 2 other locations - About 1 hr to fix
data/team_repository_test.go on lines 125..138
data/timer_repository_test.go on lines 503..516

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

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 3 locations. Consider refactoring.
Open

func (s *TeamRepositoryTestSuite) SetUpSuite() {
    e := utils.NewEnvironment(utils.TestEnv, "1.0.0")

    session, err := utils.ConnectToDatabase(e.Config)
    if err != nil {
Severity: Major
Found in data/team_repository_test.go and 2 other locations - About 1 hr to fix
data/timer_repository_test.go on lines 503..516
data/user_repository_test.go on lines 101..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 129.

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 (r *TeamRepository) FindByExternalID(externalTeamID string) (*models.Team, error) {
    team := &models.Team{}
    err := r.collection.Find(bson.M{"ext_id": externalTeamID}).One(team)

    if err != nil && err == mgo.ErrNotFound {
Severity: Minor
Found in data/team_repository.go and 1 other location - About 55 mins to fix
data/user_repository.go on lines 25..34

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

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 (r *UserRepository) FindByExternalID(externalUserID string) (*models.TeamUser, error) {
    teamUser := &models.TeamUser{}
    err := r.collection.Find(bson.M{"ext_id": externalUserID}).One(teamUser)

    if err != nil && err == mgo.ErrNotFound {
Severity: Minor
Found in data/user_repository.go and 1 other location - About 55 mins to fix
data/team_repository.go on lines 39..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 127.

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

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

    newToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
        "user_id":     bson.NewObjectId(),
        "is_team_admin": s.user.SlackUserInfo.IsAdmin,
        "name":         s.user.ExternalUserName,
        "image48":     s.user.SlackUserInfo.Profile.Image48,
Severity: Minor
Found in web/frontend_handlers_test.go and 1 other location - About 55 mins to fix
web/frontend_handlers_test.go on lines 171..179

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

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

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

    newToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
        "user_id":     bson.NewObjectId(),
        "is_team_admin": s.user.SlackUserInfo.IsAdmin,
        "name":         s.user.ExternalUserName,
        "image48":     s.user.SlackUserInfo.Profile.Image48,
Severity: Minor
Found in web/frontend_handlers_test.go and 1 other location - About 55 mins to fix
web/frontend_handlers_test.go on lines 120..128

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

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 (s *SlackOauthHandlersSuite) SetUpSuite() {

    e := utils.NewEnvironment(utils.TestEnv, "1.0.0")
    session, err := utils.ConnectToDatabase(e.Config)
    if err != nil {
Severity: Minor
Found in web/slack_oauth_redirect_test.go and 1 other location - About 40 mins to fix
web/handlers_test.go on lines 151..161

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

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 (s *TestHandlersSuite) SetUpSuite() {
    e := utils.NewEnvironment(utils.TestEnv, "1.0.0")
    session, err := utils.ConnectToDatabase(e.Config)
    if err != nil {
        log.Fatal("Failed to connect to DB!")
Severity: Minor
Found in web/handlers_test.go and 1 other location - About 40 mins to fix
web/slack_oauth_redirect_test.go on lines 77..88

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

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

TODO found
Open

    signedToken, err := jwtToken.SignedString([]byte("TODO: Extract me in config/env"))
Severity: Minor
Found in web/jwt_token.go by fixme

TODO found
Open

    token, err := newToken.SignedString([]byte("TODO: Extract me in config/env"))
Severity: Minor
Found in web/frontend_handlers_test.go by fixme

TODO found
Open

            return []byte("TODO: Extract me in config/env"), nil
Severity: Minor
Found in web/middleware.go by fixme

TODO found
Open

        //TODO move all errors into separate package
Severity: Minor
Found in data/timer_service.go by fixme

TODO found
Open

    verificationToken, err := newToken.SignedString([]byte("TODO: Extract me in config/env"))
Severity: Minor
Found in web/jwt_token_test.go by fixme

TODO found
Open

        //TODO move all errors into separate package
Severity: Minor
Found in data/timer_service.go by fixme

TODO found
Open

    token, err := newToken.SignedString([]byte("TODO: Extract me in config/env"))
Severity: Minor
Found in web/frontend_handlers_test.go by fixme

TODO found
Open

    pid := requestData["pid"] // TODO: sanitize pid
Severity: Minor
Found in web/frontend_handlers.go by fixme
Severity
Category
Status
Source
Language