ory-am/hydra

View on GitHub

Showing 412 of 865 total issues

Function TestCreateRefreshTokenSessionStress has a Cognitive Complexity of 64 (exceeds 20 allowed). Consider refactoring.
Open

func TestCreateRefreshTokenSessionStress(t *testing.T) {
    if testing.Short() {
        return
    }

Severity: Minor
Found in oauth2/oauth2_refresh_token_test.go - About 7 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 TestMigrations has 202 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestMigrations(t *testing.T) {
    connections := make(map[string]*pop.Connection, 1)

    if testing.Short() {
        reg := internal.NewMockedRegistry(t, &contextx.Default{})
Severity: Major
Found in persistence/sql/migratest/migration_test.go - About 7 hrs to fix

    Function BenchmarkAuthCode has 200 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func BenchmarkAuthCode(b *testing.B) {
        flag.Parse()
    
        ctx := context.Background()
    
    
    Severity: Major
    Found in oauth2/oauth2_auth_code_bench_test.go - About 7 hrs to fix

      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 TestKeyManager_GetKey has 181 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestKeyManager_GetKey(t *testing.T) {
          ctrl := gomock.NewController(t)
          hsmContext := NewMockContext(ctrl)
          defer ctrl.Finish()
          l := logrusx.New("", "")
      Severity: Major
      Found in hsm/manager_hsm_test.go - About 6 hrs to fix

        File persister_consent.go has 673 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Copyright © 2022 Ory Corp
        // SPDX-License-Identifier: Apache-2.0
        
        package sql
        
        
        Severity: Minor
        Found in persistence/sql/persister_consent.go - About 6 hrs to fix

          Function TestValidateCsrfSession has 178 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestValidateCsrfSession(t *testing.T) {
              const name = "oauth2_authentication_csrf"
          
              type cookie struct {
                  name      string
          Severity: Major
          Found in consent/helper_test.go - About 6 hrs to fix

            File api_oidc.go has 666 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            /*
            Ory Hydra API
            
            Documentation for all of Ory Hydra's APIs.
            
            
            Severity: Minor
            Found in internal/httpclient/api_oidc.go - About 6 hrs to fix

              Function NewKeysImportCmd has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
              Open

              func NewKeysImportCmd() *cobra.Command {
                  cmd := &cobra.Command{
                      Use:  "jwk set-id file-1 [file-2] [file-n]",
                      Args: cobra.MinimumNArgs(1),
                      Example: `{{ .CommandPath }} my-set ./path/to/jwk.json ./path/to/jwk-2.json --format json
              Severity: Minor
              Found in cmd/cmd_import_jwk.go - About 5 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 createPlan has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
              Open

              func createPlan(t *testing.T, extra url.Values, isParallel bool) {
                  planName := extra.Get("planName")
                  if stringslice.Has(skipWhenShort, planName) && testing.Short() {
                      t.Skipf("Skipping test plan '%s' because short tests", planName)
                      return
              Severity: Minor
              Found in test/conformance/run_test.go - About 5 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 TestKeyManager_GenerateAndPersistKeySet has 172 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestKeyManager_GenerateAndPersistKeySet(t *testing.T) {
                  ctrl := gomock.NewController(t)
                  hsmContext := NewMockContext(ctrl)
                  defer ctrl.Finish()
                  l := logrusx.New("", "")
              Severity: Major
              Found in hsm/manager_hsm_test.go - About 5 hrs to fix

                File index.js has 409 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // Copyright © 2022 Ory Corp
                // SPDX-License-Identifier: Apache-2.0
                
                const express = require("express")
                const session = require("express-session")
                Severity: Minor
                Found in test/e2e/oauth2-client/src/index.js - About 5 hrs to fix

                  Function TestDoesRequestSatisfyTermination has 168 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestDoesRequestSatisfyTermination(t *testing.T) {
                      c := internal.NewConfigurationWithDefaultsAndHTTPS()
                      r := internal.NewRegistryMemory(t, c, &contextx.Default{})
                  
                      t.Run("case=tls-termination-disabled", func(t *testing.T) {
                  Severity: Major
                  Found in x/tls_termination_test.go - About 5 hrs to fix

                    OAuth2ClientTokenLifespans has 42 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type OAuth2ClientTokenLifespans struct {
                        // Specify a time duration in milliseconds, seconds, minutes, hours.
                        AuthorizationCodeGrantAccessTokenLifespan *string `json:"authorization_code_grant_access_token_lifespan,omitempty"`
                        // Specify a time duration in milliseconds, seconds, minutes, hours.
                        AuthorizationCodeGrantIdTokenLifespan *string `json:"authorization_code_grant_id_token_lifespan,omitempty"`
                    Severity: Minor
                    Found in internal/httpclient/model_o_auth2_client_token_lifespans.go - About 5 hrs to fix

                      Function NewPerformAuthorizationCodeCmd has 165 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func NewPerformAuthorizationCodeCmd() *cobra.Command {
                          cmd := &cobra.Command{
                              Use:     "authorization-code",
                              Example: "{{ .CommandPath }} --client-id ... --client-secret ...",
                              Short:   "Example OAuth 2.0 Client performing the OAuth 2.0 Authorize Code Flow",
                      Severity: Major
                      Found in cmd/cmd_perform_authorization_code.go - About 5 hrs to fix

                        Function TestKeyManagerStrategy has 164 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func TestKeyManagerStrategy(t *testing.T) {
                            t.Parallel()
                            ctrl := gomock.NewController(t)
                            softwareKeyManager := NewMockManager(ctrl)
                            hardwareKeyManager := NewMockManager(ctrl)
                        Severity: Major
                        Found in jwk/manager_strategy_test.go - About 5 hrs to fix

                          File registry_sql.go has 630 lines of code (exceeds 500 allowed). Consider refactoring.
                          Open

                          // Copyright © 2022 Ory Corp
                          // SPDX-License-Identifier: Apache-2.0
                          
                          package driver
                          
                          
                          Severity: Minor
                          Found in driver/registry_sql.go - About 5 hrs to fix

                            Function TestCustomClaimsInSession has 151 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func TestCustomClaimsInSession(t *testing.T) {
                                ctx := context.Background()
                                c := internal.NewConfigurationWithDefaults()
                            
                                t.Run("no_custom_claims", func(t *testing.T) {
                            Severity: Major
                            Found in oauth2/session_custom_claims_test.go - About 5 hrs to fix

                              AcceptOAuth2LoginRequest has 38 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              type AcceptOAuth2LoginRequest struct {
                                  // ACR sets the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it to express that, for example, a user authenticated using two factor authentication.
                                  Acr     *string     `json:"acr,omitempty"`
                                  Amr     []string    `json:"amr,omitempty"`
                                  Context interface{} `json:"context,omitempty"`
                              Severity: Minor
                              Found in internal/httpclient/model_accept_o_auth2_login_request.go - About 5 hrs to fix

                                OAuth2ConsentSession has 38 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                type OAuth2ConsentSession struct {
                                    ConsentRequest           *OAuth2ConsentRequest          `json:"consent_request,omitempty"`
                                    Context                  interface{}                    `json:"context,omitempty"`
                                    ExpiresAt                *OAuth2ConsentSessionExpiresAt `json:"expires_at,omitempty"`
                                    GrantAccessTokenAudience []string                       `json:"grant_access_token_audience,omitempty"`
                                Severity: Minor
                                Found in internal/httpclient/model_o_auth2_consent_session.go - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language