ory-am/hydra

View on GitHub

Showing 412 of 865 total issues

Function TestHelperCreateGetUpdateDeleteClientNext has 83 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestHelperCreateGetUpdateDeleteClientNext(t *testing.T, m Storage, networks []uuid.UUID) {
    ctx := context.Background()

    resources := map[uuid.UUID][]Client{}
    for k := range networks {
Severity: Major
Found in client/manager_test_helpers.go - About 2 hrs to fix

    Function createPlan has 82 lines of code (exceeds 50 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: Major
    Found in test/conformance/run_test.go - About 2 hrs to fix

      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

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

              type DefaultStrategy struct {
                  c *config.DefaultProvider
                  r InternalRegistry
              }
              Severity: Minor
              Found in consent/strategy_default.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 DefaultStrategy.verifyAuthentication has 23 return statements (exceeds 4 allowed).
                          Open

                          func (s *DefaultStrategy) verifyAuthentication(
                              ctx context.Context,
                              w http.ResponseWriter,
                              r *http.Request,
                              req fosite.AuthorizeRequester,
                          Severity: Major
                          Found in consent/strategy_default.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 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 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 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 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language