ory-am/hydra

View on GitHub

Showing 402 of 849 total issues

Function run has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const run = (client) => {
      const codeChallenge = "QeNVR-BHuB6I2d0HycQzp2qUNNKi_-5QoR4fQSifLH0"
      const codeVerifier =
        "ZmRrenFxZ3pid3A0T0xqY29falJNUS5lWlY4SDBxS182U21uQkhjZ3UuOXpnd3NOak56d2lLMTVYemNNdHdNdlE5TW03WC1RZUlaM0N5R2FhdGRpNW1oVGhjbzVuRFBD"
      const state = prng()
Severity: Major
Found in cypress/support/commands.js - About 2 hrs to fix

    Method RegistrySQL.Init has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *RegistrySQL) Init(
        ctx context.Context,
        skipNetworkInit bool,
        migrate bool,
        ctxer contextx.Contextualizer,
    Severity: Minor
    Found in driver/registry_sql.go - About 2 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

    Method OAuth2ApiService.ListOAuth2ConsentSessionsExecute has 81 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (a *OAuth2ApiService) ListOAuth2ConsentSessionsExecute(r ApiListOAuth2ConsentSessionsRequest) ([]OAuth2ConsentSession, *http.Response, error) {
        var (
            localVarHTTPMethod  = http.MethodGet
            localVarPostBody    interface{}
            formFiles           []formFile
    Severity: Major
    Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

      Method Handler.introspectOAuth2Token has 81 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (h *Handler) introspectOAuth2Token(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
          ctx := r.Context()
          session := NewSessionWithCustomClaims(ctx, h.c, "")
      
          if r.Method != "POST" {
      Severity: Major
      Found in oauth2/handler.go - About 2 hrs to fix

        Method OAuth2ApiService.ListOAuth2ClientsExecute has 80 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (a *OAuth2ApiService) ListOAuth2ClientsExecute(r ApiListOAuth2ClientsRequest) ([]OAuth2Client, *http.Response, error) {
            var (
                localVarHTTPMethod  = http.MethodGet
                localVarPostBody    interface{}
                formFiles           []formFile
        Severity: Major
        Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

          Client has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type Client struct {
              NID uuid.UUID `db:"nid" faker:"-" json:"-"`
          
              // OAuth 2.0 Client ID
              //
          Severity: Minor
          Found in client/client.go - About 2 hrs to fix

            Method Handler.performOidcFrontOrBackChannelLogout has 79 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (h *Handler) performOidcFrontOrBackChannelLogout(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                ctx := r.Context()
            
                handled, err := h.r.ConsentStrategy().HandleOpenIDConnectLogout(ctx, w, r)
                if errors.Is(err, consent.ErrAbortOAuth2Request) {
            Severity: Major
            Found in oauth2/handler.go - About 2 hrs to fix

              Method OidcApiService.SetOidcDynamicClientExecute has 78 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (a *OidcApiService) SetOidcDynamicClientExecute(r ApiSetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
                  var (
                      localVarHTTPMethod  = http.MethodPut
                      localVarPostBody    interface{}
                      formFiles           []formFile
              Severity: Major
              Found in internal/httpclient/api_oidc.go - About 2 hrs to fix

                Method OAuth2ApiService.Oauth2TokenExchangeExecute has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (a *OAuth2ApiService) Oauth2TokenExchangeExecute(r ApiOauth2TokenExchangeRequest) (*OAuth2TokenExchange, *http.Response, error) {
                    var (
                        localVarHTTPMethod  = http.MethodPost
                        localVarPostBody    interface{}
                        formFiles           []formFile
                Severity: Major
                Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                  Method OAuth2ApiService.PatchOAuth2ClientExecute has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (a *OAuth2ApiService) PatchOAuth2ClientExecute(r ApiPatchOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
                      var (
                          localVarHTTPMethod  = http.MethodPatch
                          localVarPostBody    interface{}
                          formFiles           []formFile
                  Severity: Major
                  Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                    Method OAuth2ApiService.GetOAuth2ConsentRequestExecute has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (a *OAuth2ApiService) GetOAuth2ConsentRequestExecute(r ApiGetOAuth2ConsentRequestRequest) (*OAuth2ConsentRequest, *http.Response, error) {
                        var (
                            localVarHTTPMethod  = http.MethodGet
                            localVarPostBody    interface{}
                            formFiles           []formFile
                    Severity: Major
                    Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                      Method OAuth2ApiService.CreateOAuth2ClientExecute has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (a *OAuth2ApiService) CreateOAuth2ClientExecute(r ApiCreateOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
                          var (
                              localVarHTTPMethod  = http.MethodPost
                              localVarPostBody    interface{}
                              formFiles           []formFile
                      Severity: Major
                      Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                        Method OAuth2ApiService.GetOAuth2LoginRequestExecute has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (a *OAuth2ApiService) GetOAuth2LoginRequestExecute(r ApiGetOAuth2LoginRequestRequest) (*OAuth2LoginRequest, *http.Response, error) {
                            var (
                                localVarHTTPMethod  = http.MethodGet
                                localVarPostBody    interface{}
                                formFiles           []formFile
                        Severity: Major
                        Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                          Method DefaultStrategy.forwardAuthenticationRequest has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (s *DefaultStrategy) forwardAuthenticationRequest(ctx context.Context, w http.ResponseWriter, r *http.Request, ar fosite.AuthorizeRequester, subject string, authenticatedAt time.Time, session *flow.LoginSession) error {
                              if (subject != "" && authenticatedAt.IsZero()) || (subject == "" && !authenticatedAt.IsZero()) {
                                  return errorsx.WithStack(fosite.ErrServerError.WithHint("Consent strategy returned a non-empty subject with an empty auth date, or an empty subject with a non-empty auth date."))
                              }
                          
                          
                          Severity: Major
                          Found in consent/strategy_default.go - About 2 hrs to fix

                            Method OidcApiService.CreateOidcDynamicClientExecute has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (a *OidcApiService) CreateOidcDynamicClientExecute(r ApiCreateOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
                                var (
                                    localVarHTTPMethod  = http.MethodPost
                                    localVarPostBody    interface{}
                                    formFiles           []formFile
                            Severity: Major
                            Found in internal/httpclient/api_oidc.go - About 2 hrs to fix

                              Method OAuth2ApiService.GetOAuth2LogoutRequestExecute has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (a *OAuth2ApiService) GetOAuth2LogoutRequestExecute(r ApiGetOAuth2LogoutRequestRequest) (*OAuth2LogoutRequest, *http.Response, error) {
                                  var (
                                      localVarHTTPMethod  = http.MethodGet
                                      localVarPostBody    interface{}
                                      formFiles           []formFile
                              Severity: Major
                              Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                                Method OidcConfiguration.ToMap has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (o OidcConfiguration) ToMap() (map[string]interface{}, error) {
                                    toSerialize := map[string]interface{}{}
                                    toSerialize["authorization_endpoint"] = o.AuthorizationEndpoint
                                    if !IsNil(o.BackchannelLogoutSessionSupported) {
                                        toSerialize["backchannel_logout_session_supported"] = o.BackchannelLogoutSessionSupported
                                Severity: Major
                                Found in internal/httpclient/model_oidc_configuration.go - About 2 hrs to fix

                                  Function parameterAddToHeaderOrQuery has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
                                      var v = reflect.ValueOf(obj)
                                      var value = ""
                                      if v == reflect.ValueOf(nil) {
                                          value = "null"
                                  Severity: Major
                                  Found in internal/httpclient/client.go - About 2 hrs to fix

                                    Function TestKeyManager_DeleteKey has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func TestKeyManager_DeleteKey(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 2 hrs to fix

                                      Function TestKeyManager_HsmKeySetPrefix has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                                      Open

                                      func TestKeyManager_HsmKeySetPrefix(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 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language