Showing 853 of 853 total issues
Method OAuth2APIService.SetOAuth2ClientLifespansExecute
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *OAuth2APIService) SetOAuth2ClientLifespansExecute(r ApiSetOAuth2ClientLifespansRequest) (*OAuth2Client, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPut
localVarPostBody interface{}
formFiles []formFile
Method JwkAPIService.GetJsonWebKeyExecute
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *JwkAPIService) GetJsonWebKeyExecute(r ApiGetJsonWebKeyRequest) (*JsonWebKeySet, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method JwkAPIService.SetJsonWebKeySetExecute
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *JwkAPIService) SetJsonWebKeySetExecute(r ApiSetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPut
localVarPostBody interface{}
formFiles []formFile
Method MetadataAPIService.IsAliveExecute
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *MetadataAPIService) IsAliveExecute(r ApiIsAliveRequest) (*HealthStatus, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method MetadataAPIService.IsReadyExecute
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *MetadataAPIService) IsReadyExecute(r ApiIsReadyRequest) (*IsReady200Response, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Function checkTokenResponse
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func checkTokenResponse(token oauth2token) {
if token.RefreshToken == "" {
log.Fatalf("Expected a refresh token but none received: %+v", token)
}
Function testHelperExpiryFields
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func testHelperExpiryFields(reg InternalRegistry) func(t *testing.T) {
return func(t *testing.T) {
m := reg.OAuth2Storage()
t.Parallel()
Method OAuth2APIService.GetOAuth2ClientExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *OAuth2APIService) GetOAuth2ClientExecute(r ApiGetOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.GetTrustedOAuth2JwtGrantIssuerExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *OAuth2APIService) GetTrustedOAuth2JwtGrantIssuerExecute(r ApiGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.RevokeOAuth2TokenExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *OAuth2APIService) RevokeOAuth2TokenExecute(r ApiRevokeOAuth2TokenRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
Method OidcAPIService.GetOidcDynamicClientExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *OidcAPIService) GetOidcDynamicClientExecute(r ApiGetOidcDynamicClientRequest) (*OAuth2Client, *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
func (a *OAuth2APIService) TrustOAuth2JwtGrantIssuerExecute(r ApiTrustOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
Method OAuth2APIService.RevokeOAuth2ConsentSessionsExecute
has 63 lines of code (exceeds 50 allowed). Consider refactoring. 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
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
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
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
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
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)
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (p *Persister) CreateOpenIDConnectSession(ctx context.Context, signature string, requester fosite.Requester) (err error) {
ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.CreateOpenIDConnectSession")
defer otelx.End(span, &err)
events.Trace(ctx, events.IdentityTokenIssued, toEventOptions(requester)...)
// The expiry of an OIDC session is equal to the expiry of the authorization code. If the code is invalid, so is this OIDC request.
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 159.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
ID: fmt.Sprintf("%s_flush-consent-2", uniqueName),
RequestedScope: []string{"foo", "bar"},
Subject: fmt.Sprintf("%s_flush-consent-2", uniqueName),
OpenIDConnectContext: nil,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 159.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76