Showing 412 of 865 total issues
Function TestCreateRefreshTokenSessionStress
has a Cognitive Complexity of 64 (exceeds 20 allowed). Consider refactoring. Open
func TestCreateRefreshTokenSessionStress(t *testing.T) {
if testing.Short() {
return
}
- 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 TestMigrations
has 202 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestMigrations(t *testing.T) {
connections := make(map[string]*pop.Connection, 1)
if testing.Short() {
reg := internal.NewMockedRegistry(t, &contextx.Default{})
Function BenchmarkAuthCode
has 200 lines of code (exceeds 50 allowed). Consider refactoring. Open
func BenchmarkAuthCode(b *testing.B) {
flag.Parse()
ctx := context.Background()
Function TestAuthCodeWithDefaultStrategy
has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring. 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, "")
- 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 TestKeyManager_GetKey
has 181 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestKeyManager_GetKey(t *testing.T) {
ctrl := gomock.NewController(t)
hsmContext := NewMockContext(ctrl)
defer ctrl.Finish()
l := logrusx.New("", "")
File persister_consent.go
has 673 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package sql
Function TestValidateCsrfSession
has 178 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestValidateCsrfSession(t *testing.T) {
const name = "oauth2_authentication_csrf"
type cookie struct {
name string
File api_oidc.go
has 666 lines of code (exceeds 500 allowed). Consider refactoring. Open
/*
Ory Hydra API
Documentation for all of Ory Hydra's APIs.
Function NewKeysImportCmd
has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring. Open
func NewKeysImportCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "jwk set-id file-1 [file-2] [file-n]",
Args: cobra.MinimumNArgs(1),
Example: `{{ .CommandPath }} my-set ./path/to/jwk.json ./path/to/jwk-2.json --format json
- 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 createPlan
has a Cognitive Complexity of 54 (exceeds 20 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
- 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 TestKeyManager_GenerateAndPersistKeySet
has 172 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestKeyManager_GenerateAndPersistKeySet(t *testing.T) {
ctrl := gomock.NewController(t)
hsmContext := NewMockContext(ctrl)
defer ctrl.Finish()
l := logrusx.New("", "")
File index.js
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
const express = require("express")
const session = require("express-session")
Function TestDoesRequestSatisfyTermination
has 168 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestDoesRequestSatisfyTermination(t *testing.T) {
c := internal.NewConfigurationWithDefaultsAndHTTPS()
r := internal.NewRegistryMemory(t, c, &contextx.Default{})
t.Run("case=tls-termination-disabled", func(t *testing.T) {
OAuth2ClientTokenLifespans
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
type OAuth2ClientTokenLifespans struct {
// Specify a time duration in milliseconds, seconds, minutes, hours.
AuthorizationCodeGrantAccessTokenLifespan *string `json:"authorization_code_grant_access_token_lifespan,omitempty"`
// Specify a time duration in milliseconds, seconds, minutes, hours.
AuthorizationCodeGrantIdTokenLifespan *string `json:"authorization_code_grant_id_token_lifespan,omitempty"`
Function NewPerformAuthorizationCodeCmd
has 165 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewPerformAuthorizationCodeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "authorization-code",
Example: "{{ .CommandPath }} --client-id ... --client-secret ...",
Short: "Example OAuth 2.0 Client performing the OAuth 2.0 Authorize Code Flow",
Function TestKeyManagerStrategy
has 164 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestKeyManagerStrategy(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
softwareKeyManager := NewMockManager(ctrl)
hardwareKeyManager := NewMockManager(ctrl)
File registry_sql.go
has 630 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package driver
Function TestCustomClaimsInSession
has 151 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestCustomClaimsInSession(t *testing.T) {
ctx := context.Background()
c := internal.NewConfigurationWithDefaults()
t.Run("no_custom_claims", func(t *testing.T) {
AcceptOAuth2LoginRequest
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
type AcceptOAuth2LoginRequest struct {
// ACR sets the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it to express that, for example, a user authenticated using two factor authentication.
Acr *string `json:"acr,omitempty"`
Amr []string `json:"amr,omitempty"`
Context interface{} `json:"context,omitempty"`
OAuth2ConsentSession
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
type OAuth2ConsentSession struct {
ConsentRequest *OAuth2ConsentRequest `json:"consent_request,omitempty"`
Context interface{} `json:"context,omitempty"`
ExpiresAt *OAuth2ConsentSessionExpiresAt `json:"expires_at,omitempty"`
GrantAccessTokenAudience []string `json:"grant_access_token_audience,omitempty"`