ory-am/hydra

View on GitHub
internal/testhelpers/janitor_test_helper.go

Summary

Maintainability
F
6 days
Test Coverage

File janitor_test_helper.go has 734 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0

package testhelpers

Severity: Minor
Found in internal/testhelpers/janitor_test_helper.go - About 7 hrs to fix

    JanitorConsentTestHelper has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type JanitorConsentTestHelper struct {
        uniqueName           string
        flushLoginRequests   []*flow.LoginRequest
        flushConsentRequests []*flow.OAuth2ConsentRequest
        flushAccessRequests  []*fosite.Request
    Severity: Minor
    Found in internal/testhelpers/janitor_test_helper.go - About 3 hrs to fix

      Function JanitorTests has 72 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func JanitorTests(
          reg interface {
              ConsentManager() consent.Manager
              OAuth2Storage() x.FositeStorer
              config.Provider
      Severity: Minor
      Found in internal/testhelpers/janitor_test_helper.go - About 1 hr to fix

        Function getGrantRequests has 56 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func getGrantRequests(uniqueName string, lifespan time.Duration) []*createGrantRequest {
            return []*createGrantRequest{
                {
                    grant: trust.Grant{
                        ID:      uuid.New().String(),
        Severity: Minor
        Found in internal/testhelpers/janitor_test_helper.go - About 1 hr to fix

          Function getRefreshRequests has 51 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func getRefreshRequests(uniqueName string, lifespan time.Duration) []*fosite.AccessRequest {
              var tokenSignature = "4c7c7e8b3a77ad0c3ec846a21653c48b45dbfa31" //nolint:gosec
              return []*fosite.AccessRequest{
                  {
                      GrantTypes: []string{
          Severity: Minor
          Found in internal/testhelpers/janitor_test_helper.go - About 1 hr to fix

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

                    t.Run("case=flush-consent-request-rejection", func(t *testing.T) {
                        jt := NewConsentJanitorTestHelper(network + "loginRejection")
            
                        t.Run(fmt.Sprintf("case=%s", "loginRejection"), func(t *testing.T) {
                            // setup
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 4 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 642..676

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

            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

                    t.Run("case=flush-consent-request-timeout", func(t *testing.T) {
                        jt := NewConsentJanitorTestHelper(network + "loginTimeout")
            
                        t.Run(fmt.Sprintf("case=%s", "login-timeout"), func(t *testing.T) {
            
            
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 4 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 609..640

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

            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 (j *JanitorConsentTestHelper) RefreshTokenNotAfterValidate(ctx context.Context, notAfter time.Time, store x.FositeStorer) func(t *testing.T) {
                return func(t *testing.T) {
                    var err error
                    ds := new(oauth2.Session)
            
            
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 3 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 105..122

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

            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 (j *JanitorConsentTestHelper) AccessTokenNotAfterValidate(ctx context.Context, notAfter time.Time, store x.FositeStorer) func(t *testing.T) {
                return func(t *testing.T) {
                    var err error
                    ds := new(oauth2.Session)
            
            
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 3 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 134..151

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

            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

                    {
                        grant: trust.Grant{
                            ID:      uuid.New().String(),
                            Issuer:  fmt.Sprintf("%s_flush-grant-iss-3", uniqueName),
                            Subject: fmt.Sprintf("%s_flush-grant-sub-3", uniqueName),
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 2 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 871..888

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

            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

                    {
                        grant: trust.Grant{
                            ID:      uuid.New().String(),
                            Issuer:  fmt.Sprintf("%s_flush-grant-iss-2", uniqueName),
                            Subject: fmt.Sprintf("%s_flush-grant-sub-2", uniqueName),
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 2 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 889..906

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

            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

                    {
                        GrantTypes: []string{
                            "refresh_token",
                        },
                        Request: fosite.Request{
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 2 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 747..762

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

            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

                    {
                        GrantTypes: []string{
                            "refresh_token",
                        },
                        Request: fosite.Request{
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 2 hrs to fix
            internal/testhelpers/janitor_test_helper.go on lines 731..746

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

            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

                    {
                        ID:             fmt.Sprintf("%s_flush-access-2", uniqueName),
                        RequestedAt:    time.Now().Round(time.Second).Add(-(lifespan + time.Minute)),
                        Client:         &client.Client{ID: fmt.Sprintf("%s_flush-access-2", uniqueName)},
                        RequestedScope: fosite.Arguments{"fa", "ba"},
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 700..708

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

            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

                    {
                        ID:             fmt.Sprintf("%s_flush-access-3", uniqueName),
                        RequestedAt:    time.Now().Round(time.Second).Add(-(lifespan + time.Hour)),
                        Client:         &client.Client{ID: fmt.Sprintf("%s_flush-access-3", uniqueName)},
                        RequestedScope: fosite.Arguments{"fa", "ba"},
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 691..699

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

            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 (j *JanitorConsentTestHelper) RefreshTokenNotAfterSetup(ctx context.Context, cl client.Manager, store x.FositeStorer) func(t *testing.T) {
                return func(t *testing.T) {
                    // Create refresh token clients and session
                    for _, fr := range j.flushRefreshRequests {
                        require.NoError(t, cl.CreateClient(ctx, fr.Client.(*client.Client)))
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 94..103

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

            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 (j *JanitorConsentTestHelper) AccessTokenNotAfterSetup(ctx context.Context, cl client.Manager, store x.FositeStorer) func(t *testing.T) {
                return func(t *testing.T) {
                    // Create access token clients and session
                    for _, r := range j.flushAccessRequests {
                        require.NoError(t, cl.CreateClient(ctx, r.Client.(*client.Client)))
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 124..132

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

            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

                    {
                        ID:                   fmt.Sprintf("%s_flush-consent-2", uniqueName),
                        RequestedScope:       []string{"foo", "bar"},
                        Subject:              fmt.Sprintf("%s_flush-consent-2", uniqueName),
                        OpenIDConnectContext: nil,
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 836..847

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

            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

                    {
                        ID:                   fmt.Sprintf("%s_flush-consent-3", uniqueName),
                        RequestedScope:       []string{"foo", "bar"},
                        Subject:              fmt.Sprintf("%s_flush-consent-3", uniqueName),
                        OpenIDConnectContext: nil,
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 824..835

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

            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 (j *JanitorConsentTestHelper) LimitValidate(ctx context.Context, cm consent.Manager) func(t *testing.T) {
                return func(t *testing.T) {
                    // flush-login-2 and 3 should be cleared now
                    for _, r := range j.flushLoginRequests {
                        t.Logf("check login: %s", r.ID)
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 221..231

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

            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 (j *JanitorConsentTestHelper) LoginRejectionValidate(ctx context.Context, cm consent.Manager) func(t *testing.T) {
                return func(t *testing.T) {
                    // flush-login-2 and 3 should be cleared now
                    for _, r := range j.flushLoginRequests {
                        t.Logf("check login: %s", r.ID)
            Severity: Major
            Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
            internal/testhelpers/janitor_test_helper.go on lines 265..275

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

            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

            There are no issues that match your filters.

            Category
            Status