Showing 412 of 865 total issues
Function testHelperExpiryFields
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func testHelperExpiryFields(reg InternalRegistry) func(t *testing.T) {
return func(t *testing.T) {
m := reg.OAuth2Storage()
t.Parallel()
Method OAuth2APIService.GetTrustedOAuth2JwtGrantIssuerExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) GetTrustedOAuth2JwtGrantIssuerExecute(r ApiGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.TrustOAuth2JwtGrantIssuerExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) TrustOAuth2JwtGrantIssuerExecute(r ApiTrustOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.RevokeOAuth2TokenExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) RevokeOAuth2TokenExecute(r ApiRevokeOAuth2TokenRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.GetOAuth2ClientExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) GetOAuth2ClientExecute(r ApiGetOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OidcAPIService.GetOidcDynamicClientExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OidcAPIService) GetOidcDynamicClientExecute(r ApiGetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.RevokeOAuth2ConsentSessionsExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) RevokeOAuth2ConsentSessionsExecute(r ApiRevokeOAuth2ConsentSessionsRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
Function TestJanitorHandler_PurgeLoginConsent
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
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
Method JwkAPIService.GetJsonWebKeySetExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *JwkAPIService) GetJsonWebKeySetExecute(r ApiGetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Function TestJanitorHandler_Arguments
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestJanitorHandler_Arguments(t *testing.T) {
cmdx.ExecNoErr(t, cmd.NewRootCmd(nil, nil, nil),
"janitor",
fmt.Sprintf("--%s", cli.OnlyRequests),
"memory",
Function TestHandlerWellKnown
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestHandlerWellKnown(t *testing.T) {
t.Parallel()
conf := internal.NewConfigurationWithDefaults()
reg := internal.NewRegistryMemory(t, conf, &contextx.Default{})
Function TestClientCredentials
has 16 return statements (exceeds 4 allowed). Open
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)
Method OidcAPIService.DiscoverOidcConfigurationExecute
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OidcAPIService) DiscoverOidcConfigurationExecute(r ApiDiscoverOidcConfigurationRequest) (*OidcConfiguration, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OidcAPIService.GetOidcUserInfoExecute
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OidcAPIService) GetOidcUserInfoExecute(r ApiGetOidcUserInfoRequest) (*OidcUserInfo, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.OAuth2AuthorizeExecute
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *OAuth2APIService) OAuth2AuthorizeExecute(r ApiOAuth2AuthorizeRequest) (*ErrorOAuth2, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method DefaultStrategy.executeBackChannelLogout
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
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
Method WellknownAPIService.DiscoverJsonWebKeysExecute
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (a *WellknownAPIService) DiscoverJsonWebKeysExecute(r ApiDiscoverJsonWebKeysRequest) (*JsonWebKeySet, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Function readMigrations
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
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())
Function TestHandlerFindPublicKey
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestHandlerFindPublicKey(t *testing.T) {
t.Parallel()
t.Run("Test_Helper/Run_FindPublicKey_With_RSA", func(t *testing.T) {
t.Parallel()
Method APIClient.decode
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
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 {
- 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"