Showing 412 of 865 total issues
Method OidcConfiguration.ToMap
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (o OidcConfiguration) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["authorization_endpoint"] = o.AuthorizationEndpoint
if !IsNil(o.BackchannelLogoutSessionSupported) {
toSerialize["backchannel_logout_session_supported"] = o.BackchannelLogoutSessionSupported
Function parameterAddToHeaderOrQuery
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
var v = reflect.ValueOf(obj)
var value = ""
if v == reflect.ValueOf(nil) {
value = "null"
Function TestKeyManager_DeleteKey
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestKeyManager_DeleteKey(t *testing.T) {
ctrl := gomock.NewController(t)
hsmContext := NewMockContext(ctrl)
defer ctrl.Finish()
l := logrusx.New("", "")
Function TestKeyManager_HsmKeySetPrefix
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestKeyManager_HsmKeySetPrefix(t *testing.T) {
ctrl := gomock.NewController(t)
hsmContext := NewMockContext(ctrl)
defer ctrl.Finish()
l := logrusx.New("", "")
File strategy_logout_test.go
has 502 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package consent_test
Function TestGetConsentRequest
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestGetConsentRequest(t *testing.T) {
for k, tc := range []struct {
exists bool
handled bool
status int
Method OidcAPIService.CreateVerifiableCredentialExecute
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OidcAPIService) CreateVerifiableCredentialExecute(r ApiCreateVerifiableCredentialRequest) (*VerifiableCredentialResponse, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
Method RegistrySQL.Init
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *RegistrySQL) Init(
ctx context.Context,
skipNetworkInit bool,
migrate bool,
ctxer contextx.Contextualizer,
Function TestKeyManager_DeleteKeySet
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestKeyManager_DeleteKeySet(t *testing.T) {
ctrl := gomock.NewController(t)
hsmContext := NewMockContext(ctrl)
defer ctrl.Finish()
l := logrusx.New("", "")
Method Handler.oauth2TokenExchange
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
Open
func (h *Handler) oauth2TokenExchange(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
session := NewSessionWithCustomClaims(ctx, h.c, "")
accessRequest, err := h.r.OAuth2Provider().NewAccessRequest(ctx, r, session)
- 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 JanitorTests
has 72 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func JanitorTests(
reg interface {
ConsentManager() consent.Manager
OAuth2Storage() x.FositeStorer
config.Provider
Function TestRevoke
has 72 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestRevoke(t *testing.T) {
conf := internal.NewConfigurationWithDefaults()
reg := internal.NewRegistryMemory(t, conf, &contextx.Default{})
internal.MustEnsureRegistryKeys(context.Background(), reg, x.OpenIDConnectKeyName)
Method OAuth2APIService.ListTrustedOAuth2JwtGrantIssuersExecute
has 71 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) ListTrustedOAuth2JwtGrantIssuersExecute(r ApiListTrustedOAuth2JwtGrantIssuersRequest) ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method PersisterTestSuite.TestListUserAuthenticatedClientsWithBackChannelLogout
has 71 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *PersisterTestSuite) TestListUserAuthenticatedClientsWithBackChannelLogout() {
t := s.T()
for k, r := range s.registries {
t.Run(k, func(t *testing.T) {
c1 := &client.Client{ID: "client-1", BackChannelLogoutURI: "not-null"}
Method PersisterTestSuite.TestListUserAuthenticatedClientsWithFrontChannelLogout
has 71 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *PersisterTestSuite) TestListUserAuthenticatedClientsWithFrontChannelLogout() {
t := s.T()
for k, r := range s.registries {
t.Run(k, func(t *testing.T) {
c1 := &client.Client{ID: "client-1", FrontChannelLogoutURI: "not-null"}
Method DefaultStrategy.issueLogoutVerifier
has 20 return statements (exceeds 4 allowed). Open
Open
func (s *DefaultStrategy) issueLogoutVerifier(ctx context.Context, w http.ResponseWriter, r *http.Request) (*flow.LogoutResult, error) {
// There are two types of log out flows:
//
// - RP initiated logout
// - OP initiated logout
Method OAuth2APIService.IntrospectOAuth2TokenExecute
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) IntrospectOAuth2TokenExecute(r ApiIntrospectOAuth2TokenRequest) (*IntrospectedOAuth2Token, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
Method Handler.acceptOAuth2LoginRequest
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (h *Handler) acceptOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ctx := r.Context()
challenge := stringsx.Coalesce(
r.URL.Query().Get("login_challenge"),
Method router.consentGET
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (rt *router) consentGET(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
req, raw, err := rt.cl.OAuth2API.GetOAuth2ConsentRequest(r.Context()).
ConsentChallenge(r.URL.Query().Get("consent_challenge")).
Execute()
if err != nil {
Method Validator.Validate
has 19 return statements (exceeds 4 allowed). Open
Open
func (v *Validator) Validate(ctx context.Context, c *Client) error {
if c.TokenEndpointAuthMethod == "" {
c.TokenEndpointAuthMethod = "client_secret_basic"
} else if c.TokenEndpointAuthMethod == "private_key_jwt" {
if len(c.JSONWebKeysURI) == 0 && c.JSONWebKeys == nil {