Showing 412 of 865 total issues
File api_o_auth2.go
has 2579 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
/*
Ory Hydra API
Documentation for all of Ory Hydra's APIs.
Function TestAuthCodeWithDefaultStrategy
has 947 lines of code (exceeds 50 allowed). Consider refactoring. Open
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, "")
File persister_nid_test.go
has 1917 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package sql_test
Function TestStrategyLoginConsentNext
has 866 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestStrategyLoginConsentNext(t *testing.T) {
ctx := context.Background()
reg := internal.NewMockedRegistry(t, &contextx.Default{})
reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
reg.Config().MustSet(ctx, config.KeyConsentRequestMaxAge, time.Hour)
OAuth2Client
has 194 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type OAuth2Client struct {
// OAuth 2.0 Access Token Strategy AccessTokenStrategy is the strategy used to generate access tokens. Valid options are `jwt` and `opaque`. `jwt` is a bad idea, see https://www.ory.sh/docs/hydra/advanced#json-web-tokens Setting the stragegy here overrides the global setting in `strategies.access_token`.
AccessTokenStrategy *string `json:"access_token_strategy,omitempty"`
AllowedCorsOrigins []string `json:"allowed_cors_origins,omitempty"`
Audience []string `json:"audience,omitempty"`
File oauth2_auth_code_test.go
has 1661 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package oauth2_test
Function ManagerTests
has 658 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func ManagerTests(deps Deps, m consent.Manager, clientManager client.Manager, fositeManager x.FositeStorer, network string, parallel bool) func(t *testing.T) {
lr := make(map[string]*flow.LoginRequest)
return func(t *testing.T) {
if parallel {
File model_o_auth2_client.go
has 1307 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
/*
Ory Hydra API
Documentation for all of Ory Hydra's APIs.
Function ManagerTests
has a Cognitive Complexity of 145 (exceeds 20 allowed). Consider refactoring. Open
Open
func ManagerTests(deps Deps, m consent.Manager, clientManager client.Manager, fositeManager x.FositeStorer, network string, parallel bool) func(t *testing.T) {
lr := make(map[string]*flow.LoginRequest)
return func(t *testing.T) {
if parallel {
- Read upRead up
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 TestHandler
has 500 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestHandler(t *testing.T) {
ctx := context.Background()
reg := internal.NewMockedRegistry(t, &contextx.Default{})
h := client.NewHandler(reg)
reg.WithContextualizer(&contextx.TestContextualizer{})
Function TestAuthCodeWithMockStrategy
has 492 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestAuthCodeWithMockStrategy(t *testing.T) {
ctx := context.Background()
for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
t.Run("strategy="+strat.d, func(t *testing.T) {
conf := internal.NewConfigurationWithDefaults()
OidcConfiguration
has 118 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type OidcConfiguration struct {
// OAuth 2.0 Authorization Endpoint URL
AuthorizationEndpoint string `json:"authorization_endpoint"`
// OpenID Connect Back-Channel Logout Session Required Boolean value specifying whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP. If supported, the sid Claim is also included in ID Tokens issued by the OP
BackchannelLogoutSessionSupported *bool `json:"backchannel_logout_session_supported,omitempty"`
Function TestLogoutFlows
has 473 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLogoutFlows(t *testing.T) {
ctx := context.Background()
fakeKratos := kratos.NewFake()
reg := internal.NewMockedRegistry(t, &contextx.Default{})
reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
Function TestJWTBearer
has 432 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestJWTBearer(t *testing.T) {
ctx := context.Background()
reg := internal.NewMockedRegistry(t, &contextx.Default{})
reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
_, admin := testhelpers.NewOAuth2Server(ctx, t, reg)
Function TestAuthCodeWithMockStrategy
has a Cognitive Complexity of 106 (exceeds 20 allowed). Consider refactoring. Open
Open
func TestAuthCodeWithMockStrategy(t *testing.T) {
ctx := context.Background()
for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
t.Run("strategy="+strat.d, func(t *testing.T) {
conf := internal.NewConfigurationWithDefaults()
- Read upRead up
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
File fosite_store_helpers.go
has 1020 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package oauth2
File manager_test_helpers.go
has 998 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package test
PersisterTestSuite
has 84 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type PersisterTestSuite struct {
suite.Suite
registries map[string]driver.Registry
t1 context.Context
t2 context.Context
File strategy_oauth_test.go
has 921 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package consent_test
File strategy_default.go
has 904 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package consent