ory-am/hydra

View on GitHub
oauth2/oauth2_auth_code_test.go

Summary

Maintainability
F
3 wks
Test Coverage

Function TestAuthCodeWithDefaultStrategy has 945 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    File oauth2_auth_code_test.go has 1659 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Copyright © 2022 Ory Corp
    // SPDX-License-Identifier: Apache-2.0
    
    package oauth2_test
    
    
    Severity: Major
    Found in oauth2/oauth2_auth_code_test.go - About 3 days to fix

      Function TestAuthCodeWithMockStrategy has 492 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestAuthCodeWithMockStrategy(t *testing.T) {
          ctx := context.Background()
          for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
              t.Run("strategy="+strat.d, func(t *testing.T) {
                  conf := internal.NewConfigurationWithDefaults()
      Severity: Major
      Found in oauth2/oauth2_auth_code_test.go - About 2 days to fix

        Function TestAuthCodeWithMockStrategy has a Cognitive Complexity of 106 (exceeds 20 allowed). Consider refactoring.
        Open

        func TestAuthCodeWithMockStrategy(t *testing.T) {
            ctx := context.Background()
            for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
                t.Run("strategy="+strat.d, func(t *testing.T) {
                    conf := internal.NewConfigurationWithDefaults()
        Severity: Minor
        Found in oauth2/oauth2_auth_code_test.go - About 1 day 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

        Function TestAuthCodeWithDefaultStrategy has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring.
        Open

        func TestAuthCodeWithDefaultStrategy(t *testing.T) {
            ctx := context.Background()
            reg := internal.NewMockedRegistry(t, &contextx.Default{})
            reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
            reg.Config().MustSet(ctx, config.KeyRefreshTokenHook, "")
        Severity: Minor
        Found in oauth2/oauth2_auth_code_test.go - About 6 hrs 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

        Function TestAuthCodeWithDefaultStrategy has 32 return statements (exceeds 4 allowed).
        Open

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

          Function TestAuthCodeWithMockStrategy has 17 return statements (exceeds 4 allowed).
          Open

          func TestAuthCodeWithMockStrategy(t *testing.T) {
              ctx := context.Background()
              for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
                  t.Run("strategy="+strat.d, func(t *testing.T) {
                      conf := internal.NewConfigurationWithDefaults()
          Severity: Major
          Found in oauth2/oauth2_auth_code_test.go - About 1 hr to fix

            Function assertCreateVerifiableCredential has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func assertCreateVerifiableCredential(t *testing.T, reg driver.Registry, nonce string, accessToken *oauth2.Token, alg jose.SignatureAlgorithm) {
            Severity: Minor
            Found in oauth2/oauth2_auth_code_test.go - About 35 mins to fix

              Function claimsFromVCResponse has 5 return statements (exceeds 4 allowed).
              Open

              func claimsFromVCResponse(t *testing.T, reg driver.Registry, vc *hydraoauth2.VerifiableCredentialResponse) (*jwt.Token, *hydraoauth2.VerifableCredentialClaims) {
                  ctx := context.Background()
                  token, err := jwt.ParseWithClaims(vc.Credential, new(hydraoauth2.VerifableCredentialClaims), func(token *jwt.Token) (interface{}, error) {
                      kid, found := token.Header["kid"]
                      if !found {
              Severity: Major
              Found in oauth2/oauth2_auth_code_test.go - About 35 mins to fix

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

                    t.Run("case=fail token exchange if hook denies the request", func(t *testing.T) {
                        run := func(strategy string) func(t *testing.T) {
                            return func(t *testing.T) {
                                hs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                    w.WriteHeader(http.StatusForbidden)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 7 hrs to fix
                oauth2/oauth2_auth_code_test.go on lines 1056..1094
                oauth2/oauth2_auth_code_test.go on lines 1136..1174

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

                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

                    t.Run("case=fail token exchange if hook response is malformed", func(t *testing.T) {
                        run := func(strategy string) func(t *testing.T) {
                            return func(t *testing.T) {
                                hs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                    w.WriteHeader(http.StatusOK)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 7 hrs to fix
                oauth2/oauth2_auth_code_test.go on lines 1056..1094
                oauth2/oauth2_auth_code_test.go on lines 1096..1134

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

                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

                    t.Run("case=fail token exchange if hook fails", func(t *testing.T) {
                        run := func(strategy string) func(t *testing.T) {
                            return func(t *testing.T) {
                                hs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                    w.WriteHeader(http.StatusInternalServerError)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 7 hrs to fix
                oauth2/oauth2_auth_code_test.go on lines 1096..1134
                oauth2/oauth2_auth_code_test.go on lines 1136..1174

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

                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

                                    t.Run("should fail token refresh with `server_error` if refresh hook fails", func(t *testing.T) {
                                        run := func(hookType string) func(t *testing.T) {
                                            return func(t *testing.T) {
                                                hs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                                    w.WriteHeader(http.StatusInternalServerError)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 6 hrs to fix
                oauth2/oauth2_auth_code_test.go on lines 1790..1818
                oauth2/oauth2_auth_code_test.go on lines 1820..1848

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

                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

                                    t.Run("should fail token refresh with `server_error` if refresh hook response is malformed", func(t *testing.T) {
                                        run := func(hookType string) func(t *testing.T) {
                                            return func(t *testing.T) {
                                                hs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                                    w.WriteHeader(http.StatusOK)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 6 hrs to fix
                oauth2/oauth2_auth_code_test.go on lines 1760..1788
                oauth2/oauth2_auth_code_test.go on lines 1790..1818

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

                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

                                    t.Run("should fail token refresh with `access_denied` if legacy refresh hook denied the request", func(t *testing.T) {
                                        run := func(hookType string) func(t *testing.T) {
                                            return func(t *testing.T) {
                                                hs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                                    w.WriteHeader(http.StatusForbidden)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 6 hrs to fix
                oauth2/oauth2_auth_code_test.go on lines 1760..1788
                oauth2/oauth2_auth_code_test.go on lines 1820..1848

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

                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=custom-lifespans-active-opaque", func(t *testing.T) {
                            c, conf := newOAuth2Client(t, reg, testhelpers.NewCallbackURL(t, "callback", testhelpers.HTTPServerNotImplementedHandler))
                            ls := testhelpers.TestLifespans
                            ls.AuthorizationCodeGrantAccessTokenLifespan = x.NullDuration{Valid: true, Duration: 6 * time.Second}
                            testhelpers.UpdateClientTokenLifespans(
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 731..743

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

                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=custom-lifespans-active-jwt", func(t *testing.T) {
                            c, conf := newOAuth2Client(t, reg, testhelpers.NewCallbackURL(t, "callback", testhelpers.HTTPServerNotImplementedHandler))
                            ls := testhelpers.TestLifespans
                            ls.AuthorizationCodeGrantAccessTokenLifespan = x.NullDuration{Valid: true, Duration: 6 * time.Second}
                            testhelpers.UpdateClientTokenLifespans(
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 745..757

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

                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

                        withWrongClientAfterLogin := &http.Client{
                            Jar: testhelpers.NewEmptyCookieJar(t),
                            CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                                if req.URL.Path != "/oauth2/auth" {
                                    return nil
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 537..551

                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

                        withWrongClientAfterConsent := &http.Client{
                            Jar: testhelpers.NewEmptyCookieJar(t),
                            CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                                if req.URL.Path != "/oauth2/auth" {
                                    return nil
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 522..536

                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

                        withWrongScopeAfterLogin := &http.Client{
                            Jar: testhelpers.NewEmptyCookieJar(t),
                            CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                                if req.URL.Path != "/oauth2/auth" {
                                    return nil
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 569..583

                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

                        withWrongScopeAfterConsent := &http.Client{
                            Jar: testhelpers.NewEmptyCookieJar(t),
                            CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                                if req.URL.Path != "/oauth2/auth" {
                                    return nil
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 553..567

                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

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

                                    cb: func(t *testing.T) httprouter.Handle {
                                        return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                            code = r.URL.Query().Get("code")
                                            err := r.URL.Query().Get("error")
                                            require.Empty(t, code)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 1435..1442

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

                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

                                    cb: func(t *testing.T) httprouter.Handle {
                                        return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                            code = r.URL.Query().Get("code")
                                            err := r.URL.Query().Get("error")
                                            require.Empty(t, code)
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 1405..1412

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

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

                                    cb: func(t *testing.T) httprouter.Handle {
                                        return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                            code = r.URL.Query().Get("code")
                                            require.NotEmpty(t, code)
                                            _, _ = w.Write([]byte(r.URL.Query().Get("code")))
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 1370..1376
                oauth2/oauth2_auth_code_test.go on lines 1463..1469

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

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

                                    cb: func(t *testing.T) httprouter.Handle {
                                        return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                            code = r.URL.Query().Get("code")
                                            require.NotEmpty(t, code)
                                            _, _ = w.Write([]byte(r.URL.Query().Get("code")))
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 1421..1427
                oauth2/oauth2_auth_code_test.go on lines 1463..1469

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

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

                                    cb: func(t *testing.T) httprouter.Handle {
                                        return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                            code = r.URL.Query().Get("code")
                                            require.NotEmpty(t, code)
                                            _, _ = w.Write([]byte(r.URL.Query().Get("code")))
                Severity: Major
                Found in oauth2/oauth2_auth_code_test.go and 2 other locations - About 1 hr to fix
                oauth2/oauth2_auth_code_test.go on lines 1370..1376
                oauth2/oauth2_auth_code_test.go on lines 1421..1427

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

                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

                            v, _, err := adminClient.OAuth2Api.AcceptOAuth2ConsentRequest(context.Background()).
                                ConsentChallenge(r.URL.Query().Get("consent_challenge")).
                                AcceptOAuth2ConsentRequest(hydra.AcceptOAuth2ConsentRequest{
                                    GrantScope: []string{"hydra", "offline", "openid"}, Remember: pointerx.Ptr(true), RememberFor: pointerx.Ptr[int64](0),
                                    GrantAccessTokenAudience: rr.RequestedAccessTokenAudience,
                Severity: Minor
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 45 mins to fix
                oauth2/oauth2_auth_code_bench_test.go on lines 204..213

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

                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

                                    {
                                        name:   "proof=invalid format",
                                        format: "invalid_format",
                                        proof: func() string {
                                            // Create mismatching public and private keys.
                Severity: Minor
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 35 mins to fix
                oauth2/oauth2_auth_code_test.go on lines 456..466

                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

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

                                    {
                                        name:      "proof=invalid type",
                                        proofType: "invalid",
                                        proof: func() string {
                                            // Create mismatching public and private keys.
                Severity: Minor
                Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 35 mins to fix
                oauth2/oauth2_auth_code_test.go on lines 445..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 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