ory-am/hydra

View on GitHub

Showing 412 of 865 total issues

Function testHelperExpiryFields has 64 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func testHelperExpiryFields(reg InternalRegistry) func(t *testing.T) {
    return func(t *testing.T) {
        m := reg.OAuth2Storage()
        t.Parallel()

Severity: Minor
Found in oauth2/fosite_store_helpers.go - About 1 hr to fix

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

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

        Method OAuth2APIService.RevokeOAuth2TokenExecute has 63 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method OAuth2APIService.GetOAuth2ClientExecute has 63 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (a *OAuth2APIService) GetOAuth2ClientExecute(r ApiGetOAuth2ClientRequest) (*OAuth2Client, *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

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

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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language