Showing 402 of 849 total issues
Method MetadataApiService.GetVersionExecute
has 7 return statements (exceeds 4 allowed). Open
Open
func (a *MetadataApiService) GetVersionExecute(r ApiGetVersionRequest) (*GetVersion200Response, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method JwkApiService.DeleteJsonWebKeySetExecute
has 7 return statements (exceeds 4 allowed). Open
Open
func (a *JwkApiService) DeleteJsonWebKeySetExecute(r ApiDeleteJsonWebKeySetRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
Avoid deeply nested control flow statements. Open
Open
} else if s, ok := body.(*string); ok {
_, err = bodyBuf.WriteString(*s)
} else if JsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if XmlCheck.MatchString(contentType) {
Function createAccessTokenSessionPairwise
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func createAccessTokenSessionPairwise(subject, client string, token string, expiresAt time.Time, fs x.FositeStorer, scopes fosite.Arguments, obfuscated string) {
Avoid deeply nested control flow statements. Open
Open
for {
bo := conf.NextBackOff()
require.NotEqual(t, backoff.Stop, bo, "%+v", err)
_, _, err = hydra.JwkApi.CreateJsonWebKeySet(context.Background(), "hydra.openid.id-token").CreateJsonWebKeySet(hydrac.CreateJsonWebKeySet{
Function checkTokenResponse
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func checkTokenResponse(token oauth2token) {
if token.RefreshToken == "" {
log.Fatalf("Expected a refresh token but none received: %+v", token)
}
- 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 BenchmarkClientCredentials
has 7 return statements (exceeds 4 allowed). Open
Open
func BenchmarkClientCredentials(b *testing.B) {
ctx := context.Background()
spans := tracetest.NewSpanRecorder()
tracer := trace.NewTracerProvider(trace.WithSpanProcessor(spans)).Tracer("")
Method Persister.flushInactiveTokens
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (p *Persister) flushInactiveTokens(ctx context.Context, notAfter time.Time, limit int, batchSize int, table tableName, lifespan time.Duration) (err error) {
Function TestUserinfo
has 7 return statements (exceeds 4 allowed). Open
Open
func TestUserinfo(t *testing.T) {
ctx := context.Background()
conf := internal.NewConfigurationWithDefaults()
conf.MustSet(ctx, config.KeyScopeStrategy, "")
conf.MustSet(ctx, config.KeyAuthCodeLifespan, lifespan)
Method Handler.getOidcUserInfo
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func (h *Handler) getOidcUserInfo(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
session := NewSessionWithCustomClaims(ctx, h.c, "")
tokenType, ar, err := h.r.OAuth2Provider().IntrospectToken(ctx, fosite.AccessTokenFromRequest(r), fosite.AccessToken, session)
if err != nil {
- 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
Avoid deeply nested control flow statements. Open
Open
switch dbName {
case dbal.DriverMySQL:
case dbal.DriverPostgreSQL, dbal.DriverCockroachDB:
var matched bool
for _, errSubstr := range []string{
Avoid deeply nested control flow statements. Open
Open
if dbName != dbal.DriverMySQL {
t.Errorf("an unexpected RFC6749 error with the name %q was returned.\n"+
"Hint: has the refresh token error handling changed in fosite? If so, you need to add further "+
"assertions here to cover the additional errors that are being returned by the handler.\n"+
"DB version: %s\n"+
Method DefaultStrategy.requestConsent
has 6 return statements (exceeds 4 allowed). Open
Open
func (s *DefaultStrategy) requestConsent(
ctx context.Context,
w http.ResponseWriter,
r *http.Request,
ar fosite.AuthorizeRequester,
Method Flow.HandleLoginRequest
has 6 return statements (exceeds 4 allowed). Open
Open
func (f *Flow) HandleLoginRequest(h *HandledLoginRequest) error {
if f.LoginWasUsed {
return errors.WithStack(x.ErrConflict.WithHint("The login request was already used and can no longer be changed."))
}
Method OidcApiService.RevokeOidcSessionExecute
has 6 return statements (exceeds 4 allowed). Open
Open
func (a *OidcApiService) RevokeOidcSessionExecute(r ApiRevokeOidcSessionRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method DefaultStrategy.authenticationSession
has 6 return statements (exceeds 4 allowed). Open
Open
func (s *DefaultStrategy) authenticationSession(ctx context.Context, _ http.ResponseWriter, r *http.Request) (*flow.LoginSession, error) {
store, err := s.r.CookieStore(ctx)
if err != nil {
return nil, err
}
Function serve
has 6 return statements (exceeds 4 allowed). Open
Open
func serve(
ctx context.Context,
d driver.Registry,
cmd *cobra.Command,
wg *sync.WaitGroup,
Method MigrateHandler.MigrateStatus
has 6 return statements (exceeds 4 allowed). Open
Open
func (h *MigrateHandler) MigrateStatus(cmd *cobra.Command, args []string) error {
p, err := h.makePersister(cmd, args)
if err != nil {
return err
}
Function NewUpdateClientCmd
has 6 return statements (exceeds 4 allowed). Open
Open
func NewUpdateClientCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "oauth2-client [id]",
Aliases: []string{"client"},
Short: "Update an OAuth 2.0 Client",
Method Persister.GetKeySet
has 6 return statements (exceeds 4 allowed). Open
Open
func (p *Persister) GetKeySet(ctx context.Context, set string) (keys *jose.JSONWebKeySet, err error) {
ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.GetKeySet")
defer span.End()
var js []jwk.SQLData