ory-am/hydra

View on GitHub
consent/strategy_oauth_test.go

Summary

Maintainability
F
1 wk
Test Coverage

Function TestStrategyLoginConsentNext has 850 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestStrategyLoginConsentNext(t *testing.T) {
    ctx := context.Background()
    reg := internal.NewMockedRegistry(t, &contextx.Default{})
    reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
    reg.Config().MustSet(ctx, config.KeyConsentRequestMaxAge, time.Hour)
Severity: Major
Found in consent/strategy_oauth_test.go - About 4 days to fix

    File strategy_oauth_test.go has 905 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Copyright © 2022 Ory Corp
    // SPDX-License-Identifier: Apache-2.0
    
    package consent_test
    
    
    Severity: Major
    Found in consent/strategy_oauth_test.go - About 1 day to fix

      Function TestStrategyLoginConsentNext has 29 return statements (exceeds 4 allowed).
      Open

      func TestStrategyLoginConsentNext(t *testing.T) {
          ctx := context.Background()
          reg := internal.NewMockedRegistry(t, &contextx.Default{})
          reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
          reg.Config().MustSet(ctx, config.KeyConsentRequestMaxAge, time.Hour)
      Severity: Major
      Found in consent/strategy_oauth_test.go - About 2 hrs to fix

        Function TestStrategyLoginConsentNext has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
        Open

        func TestStrategyLoginConsentNext(t *testing.T) {
            ctx := context.Background()
            reg := internal.NewMockedRegistry(t, &contextx.Default{})
            reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
            reg.Config().MustSet(ctx, config.KeyConsentRequestMaxAge, time.Hour)
        Severity: Minor
        Found in consent/strategy_oauth_test.go - About 1 hr to fix

        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

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

            t.Run("case=should be able to retry both accept login and consent requests", func(t *testing.T) {
                subject := "aeneas-rekkas"
                c := createDefaultClient(t)
                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    checkAndDuplicateAcceptLoginHandler(t, adminClient, subject, func(*testing.T, *hydra.OAuth2LoginRequest, error) hydra.AcceptOAuth2LoginRequest {
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 5 hrs to fix
        consent/strategy_oauth_test.go on lines 1039..1065

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

        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=should be able to retry accept login request", func(t *testing.T) {
                subject := "aeneas-rekkas"
                c := createDefaultClient(t)
                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    checkAndDuplicateAcceptLoginHandler(t, adminClient, subject, func(*testing.T, *hydra.OAuth2LoginRequest, error) hydra.AcceptOAuth2LoginRequest {
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 5 hrs to fix
        consent/strategy_oauth_test.go on lines 1067..1093

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

        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

                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                        require.NoError(t, err)
                        assert.Empty(t, res.Subject)
                        assert.Empty(t, pointerx.StringR(res.Client.ClientSecret))
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
        consent/strategy_oauth_test.go on lines 556..578

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

        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

                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                        require.NoError(t, err)
                        assert.Empty(t, res.Subject)
                        assert.Empty(t, pointerx.StringR(res.Client.ClientSecret))
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
        consent/strategy_oauth_test.go on lines 378..400

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

        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=should pass and check if login context is set properly", func(t *testing.T) {
                // This should pass because login was remembered and session id should be set and session context should also work
                subject := "aeneas-rekkas"
                c := createDefaultClient(t)
                testhelpers.NewLoginConsentUI(t, reg.Config(),
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
        consent/strategy_oauth_test.go on lines 1012..1037

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

        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=should be able to retry accept consent request", func(t *testing.T) {
                subject := "aeneas-rekkas"
                c := createDefaultClient(t)
                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    acceptLoginHandler(t, subject, &hydra.AcceptOAuth2LoginRequest{
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
        consent/strategy_oauth_test.go on lines 609..634

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

        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

                testhelpers.NewLoginConsentUI(t, reg.Config(), func(w http.ResponseWriter, r *http.Request) {
                    vr, _, err := adminClient.OAuth2Api.RejectOAuth2LoginRequest(context.Background()).
                        LoginChallenge(r.URL.Query().Get("login_challenge")).
                        RejectOAuth2Request(hydra.RejectOAuth2Request{
                            Error:            pointerx.String(fosite.ErrInteractionRequired.ErrorField),
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 2 hrs to fix
        consent/strategy_oauth_test.go on lines 188..198

        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(w http.ResponseWriter, r *http.Request) {
                        vr, _, err := adminClient.OAuth2Api.RejectOAuth2ConsentRequest(context.Background()).
                            ConsentChallenge(r.URL.Query().Get("consent_challenge")).
                            RejectOAuth2Request(hydra.RejectOAuth2Request{
                                Error:            pointerx.String(fosite.ErrInteractionRequired.ErrorField),
        Severity: Major
        Found in consent/strategy_oauth_test.go and 1 other location - About 2 hrs to fix
        consent/strategy_oauth_test.go on lines 157..168

        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

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

                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    acceptLoginHandler(t, subject, &hydra.AcceptOAuth2LoginRequest{
                        Remember: pointerx.Bool(true),
                    }),
                    acceptConsentHandler(t, &hydra.AcceptOAuth2ConsentRequest{
        Severity: Major
        Found in consent/strategy_oauth_test.go and 3 other locations - About 1 hr to fix
        consent/strategy_oauth_test.go on lines 292..303
        consent/strategy_oauth_test.go on lines 366..377
        consent/strategy_oauth_test.go on lines 444..455

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

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

                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    acceptLoginHandler(t, subject, &hydra.AcceptOAuth2LoginRequest{
                        Remember: pointerx.Bool(true),
                    }),
                    acceptConsentHandler(t, &hydra.AcceptOAuth2ConsentRequest{
        Severity: Major
        Found in consent/strategy_oauth_test.go and 3 other locations - About 1 hr to fix
        consent/strategy_oauth_test.go on lines 292..303
        consent/strategy_oauth_test.go on lines 366..377
        consent/strategy_oauth_test.go on lines 544..555

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

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

                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    acceptLoginHandler(t, subject, &hydra.AcceptOAuth2LoginRequest{
                        Remember: pointerx.Bool(true),
                    }),
                    acceptConsentHandler(t, &hydra.AcceptOAuth2ConsentRequest{
        Severity: Major
        Found in consent/strategy_oauth_test.go and 3 other locations - About 1 hr to fix
        consent/strategy_oauth_test.go on lines 366..377
        consent/strategy_oauth_test.go on lines 444..455
        consent/strategy_oauth_test.go on lines 544..555

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

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

                testhelpers.NewLoginConsentUI(t, reg.Config(),
                    acceptLoginHandler(t, subject, &hydra.AcceptOAuth2LoginRequest{
                        Remember: pointerx.Bool(true),
                    }),
                    acceptConsentHandler(t, &hydra.AcceptOAuth2ConsentRequest{
        Severity: Major
        Found in consent/strategy_oauth_test.go and 3 other locations - About 1 hr to fix
        consent/strategy_oauth_test.go on lines 292..303
        consent/strategy_oauth_test.go on lines 444..455
        consent/strategy_oauth_test.go on lines 544..555

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

        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=should fail because a login verifier was given that doesn't exist in the store", func(t *testing.T) {
                testhelpers.NewLoginConsentUI(t, reg.Config(), testhelpers.HTTPServerNoExpectedCallHandler(t), testhelpers.HTTPServerNoExpectedCallHandler(t))
                c := createDefaultClient(t)
                hc := testhelpers.NewEmptyJarClient(t)
        
        
        Severity: Minor
        Found in consent/strategy_oauth_test.go and 1 other location - About 45 mins to fix
        consent/strategy_oauth_test.go on lines 123..135

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

        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=should fail because a non-existing consent verifier was given", func(t *testing.T) {
                // Covers:
                // - This should fail because consent verifier was set but does not exist
                // - This should fail because a consent verifier was given but no login verifier
                testhelpers.NewLoginConsentUI(t, reg.Config(), testhelpers.HTTPServerNoExpectedCallHandler(t), testhelpers.HTTPServerNoExpectedCallHandler(t))
        Severity: Minor
        Found in consent/strategy_oauth_test.go and 1 other location - About 45 mins to fix
        consent/strategy_oauth_test.go on lines 112..121

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

        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

                    checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                        require.NoError(t, err)
                        assert.False(t, res.Skip) // Skip should always be false here because prompt has login
                        return hydra.AcceptOAuth2LoginRequest{Remember: pointerx.Bool(true)}
                    }),
        Severity: Minor
        Found in consent/strategy_oauth_test.go and 1 other location - About 35 mins to fix
        consent/strategy_oauth_test.go on lines 741..747

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

        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

                        checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                            require.NoError(t, err)
                            assert.False(t, res.Skip) // Skip should always be false here
                            return hydra.AcceptOAuth2LoginRequest{
                                Remember: pointerx.Bool(true),
        Severity: Minor
        Found in consent/strategy_oauth_test.go and 1 other location - About 35 mins to fix
        consent/strategy_oauth_test.go on lines 818..822

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

        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