ory-am/hydra

View on GitHub

Showing 402 of 849 total issues

Method OAuth2ApiService.GetTrustedOAuth2JwtGrantIssuerExecute has 63 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (a *OAuth2ApiService) GetTrustedOAuth2JwtGrantIssuerExecute(r ApiGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
    var (
        localVarHTTPMethod  = http.MethodGet
        localVarPostBody    interface{}
        formFiles           []formFile
Severity: Minor
Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

    Method OidcApiService.GetOidcDynamicClientExecute has 63 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (a *OidcApiService) GetOidcDynamicClientExecute(r ApiGetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
        var (
            localVarHTTPMethod  = http.MethodGet
            localVarPostBody    interface{}
            formFiles           []formFile
    Severity: Minor
    Found in internal/httpclient/api_oidc.go - About 1 hr to fix

      Method OAuth2ApiService.RevokeOAuth2ConsentSessionsExecute has 63 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (a *OAuth2ApiService) RevokeOAuth2ConsentSessionsExecute(r ApiRevokeOAuth2ConsentSessionsRequest) (*http.Response, error) {
          var (
              localVarHTTPMethod = http.MethodDelete
              localVarPostBody   interface{}
              formFiles          []formFile
      Severity: Minor
      Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

        Function TestJanitorHandler_PurgeLoginConsent has 63 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestJanitorHandler_PurgeLoginConsent(t *testing.T) {
            /*
                Login and Consent also needs to be purged on two conditions besides the KeyConsentRequestMaxAge and notAfter time
                - when a login/consent request was never completed (timed out)
                - when a login/consent request was rejected
        Severity: Minor
        Found in cmd/cli/handler_janitor_test.go - About 1 hr to fix

          Function TestJanitorHandler_Arguments has 63 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestJanitorHandler_Arguments(t *testing.T) {
              cmdx.ExecNoErr(t, cmd.NewRootCmd(nil, nil, nil),
                  "janitor",
                  fmt.Sprintf("--%s", cli.OnlyRequests),
                  "memory",
          Severity: Minor
          Found in cmd/cli/handler_janitor_test.go - About 1 hr to fix

            Method JwkApiService.GetJsonWebKeySetExecute has 63 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (a *JwkApiService) GetJsonWebKeySetExecute(r ApiGetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
                var (
                    localVarHTTPMethod  = http.MethodGet
                    localVarPostBody    interface{}
                    formFiles           []formFile
            Severity: Minor
            Found in internal/httpclient/api_jwk.go - About 1 hr to fix

              Function TestHandlerWellKnown has 63 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestHandlerWellKnown(t *testing.T) {
                  t.Parallel()
              
                  conf := internal.NewConfigurationWithDefaults()
                  reg := internal.NewRegistryMemory(t, conf, &contextx.Default{})
              Severity: Minor
              Found in jwk/handler_test.go - About 1 hr to fix

                Function TestClientCredentials has 16 return statements (exceeds 4 allowed).
                Open

                func TestClientCredentials(t *testing.T) {
                    ctx := context.Background()
                    reg := internal.NewMockedRegistry(t, &contextx.Default{})
                    reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
                    public, admin := testhelpers.NewOAuth2Server(ctx, t, reg)
                Severity: Major
                Found in oauth2/oauth2_client_credentials_test.go - About 1 hr to fix

                  Method DefaultStrategy.executeBackChannelLogout has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (s *DefaultStrategy) executeBackChannelLogout(r *http.Request, subject, sid string) error {
                      ctx := r.Context()
                      clients, err := s.r.ConsentManager().ListUserAuthenticatedClientsWithBackChannelLogout(ctx, subject, sid)
                      if err != nil {
                          return err
                  Severity: Minor
                  Found in consent/strategy_default.go - About 1 hr to fix

                    Method OidcApiService.DiscoverOidcConfigurationExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (a *OidcApiService) DiscoverOidcConfigurationExecute(r ApiDiscoverOidcConfigurationRequest) (*OidcConfiguration, *http.Response, error) {
                        var (
                            localVarHTTPMethod  = http.MethodGet
                            localVarPostBody    interface{}
                            formFiles           []formFile
                    Severity: Minor
                    Found in internal/httpclient/api_oidc.go - About 1 hr to fix

                      Method OAuth2ApiService.OAuth2AuthorizeExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (a *OAuth2ApiService) OAuth2AuthorizeExecute(r ApiOAuth2AuthorizeRequest) (*ErrorOAuth2, *http.Response, error) {
                          var (
                              localVarHTTPMethod  = http.MethodGet
                              localVarPostBody    interface{}
                              formFiles           []formFile
                      Severity: Minor
                      Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

                        Method OidcApiService.GetOidcUserInfoExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (a *OidcApiService) GetOidcUserInfoExecute(r ApiGetOidcUserInfoRequest) (*OidcUserInfo, *http.Response, error) {
                            var (
                                localVarHTTPMethod  = http.MethodGet
                                localVarPostBody    interface{}
                                formFiles           []formFile
                        Severity: Minor
                        Found in internal/httpclient/api_oidc.go - About 1 hr to fix

                          Method WellknownApiService.DiscoverJsonWebKeysExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (a *WellknownApiService) DiscoverJsonWebKeysExecute(r ApiDiscoverJsonWebKeysRequest) (*JsonWebKeySet, *http.Response, error) {
                              var (
                                  localVarHTTPMethod  = http.MethodGet
                                  localVarPostBody    interface{}
                                  formFiles           []formFile
                          Severity: Minor
                          Found in internal/httpclient/api_wellknown.go - About 1 hr to fix

                            Function readMigrations has 61 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func readMigrations(migrationSourceFS fs.FS, expectedDialects []string) (map[string]*migrationGroup, error) {
                                mgs := make(map[string]*migrationGroup)
                                err := fs.WalkDir(migrationSourceFS, ".", func(p string, d fs.DirEntry, err2 error) error {
                                    if err2 != nil {
                                        fmt.Println("Warning: unexpected error " + err2.Error())
                            Severity: Minor
                            Found in cmd/cli/handler_migrate.go - About 1 hr to fix

                              Function TestHandlerFindPublicKey has 61 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func TestHandlerFindPublicKey(t *testing.T) {
                                  t.Parallel()
                              
                                  t.Run("Test_Helper/Run_FindPublicKey_With_RSA", func(t *testing.T) {
                                      t.Parallel()
                              Severity: Minor
                              Found in jwk/helper_test.go - About 1 hr to fix

                                Method APIClient.decode has 15 return statements (exceeds 4 allowed).
                                Open

                                func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
                                    if len(b) == 0 {
                                        return nil
                                    }
                                    if s, ok := v.(*string); ok {
                                Severity: Major
                                Found in internal/httpclient/client.go - About 1 hr to fix

                                  Method APIClient.decode has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
                                      if len(b) == 0 {
                                          return nil
                                      }
                                      if s, ok := v.(*string); ok {
                                  Severity: Minor
                                  Found in internal/httpclient/client.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

                                  Method OidcUserInfo.ToMap has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func (o OidcUserInfo) ToMap() (map[string]interface{}, error) {
                                      toSerialize := map[string]interface{}{}
                                      if !IsNil(o.Birthdate) {
                                          toSerialize["birthdate"] = o.Birthdate
                                      }
                                  Severity: Minor
                                  Found in internal/httpclient/model_oidc_user_info.go - About 1 hr to fix

                                    Method OAuth2ApiService.RevokeOAuth2LoginSessionsExecute has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func (a *OAuth2ApiService) RevokeOAuth2LoginSessionsExecute(r ApiRevokeOAuth2LoginSessionsRequest) (*http.Response, error) {
                                        var (
                                            localVarHTTPMethod = http.MethodDelete
                                            localVarPostBody   interface{}
                                            formFiles          []formFile
                                    Severity: Minor
                                    Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

                                      Method DefaultStrategy.forwardConsentRequest has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                                      Open

                                      func (s *DefaultStrategy) forwardConsentRequest(
                                          ctx context.Context,
                                          w http.ResponseWriter,
                                          r *http.Request,
                                          ar fosite.AuthorizeRequester,
                                      Severity: Minor
                                      Found in consent/strategy_default.go - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language