ory-am/hydra

View on GitHub
internal/httpclient/model_o_auth2_client.go

Summary

Maintainability
F
1 wk
Test Coverage

OAuth2Client has 194 methods (exceeds 20 allowed). Consider refactoring.
Open

type OAuth2Client struct {
    // OAuth 2.0 Access Token Strategy  AccessTokenStrategy is the strategy used to generate access tokens. Valid options are `jwt` and `opaque`. `jwt` is a bad idea, see https://www.ory.sh/docs/hydra/advanced#json-web-tokens Setting the stragegy here overrides the global setting in `strategies.access_token`.
    AccessTokenStrategy *string  `json:"access_token_strategy,omitempty"`
    AllowedCorsOrigins  []string `json:"allowed_cors_origins,omitempty"`
    Audience            []string `json:"audience,omitempty"`
Severity: Major
Found in internal/httpclient/model_o_auth2_client.go - About 3 days to fix

    File model_o_auth2_client.go has 1307 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    /*
    Ory Hydra API
    
    Documentation for all of Ory Hydra's APIs.
    
    
    Severity: Major
    Found in internal/httpclient/model_o_auth2_client.go - About 2 days to fix

      Method OAuth2Client.ToMap has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
      Open

      func (o OAuth2Client) ToMap() (map[string]interface{}, error) {
          toSerialize := map[string]interface{}{}
          if !IsNil(o.AccessTokenStrategy) {
              toSerialize["access_token_strategy"] = o.AccessTokenStrategy
          }
      Severity: Minor
      Found in internal/httpclient/model_o_auth2_client.go - About 4 hrs to fix

      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

      Method OAuth2Client.ToMap has 146 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (o OAuth2Client) ToMap() (map[string]interface{}, error) {
          toSerialize := map[string]interface{}{}
          if !IsNil(o.AccessTokenStrategy) {
              toSerialize["access_token_strategy"] = o.AccessTokenStrategy
          }
      Severity: Major
      Found in internal/httpclient/model_o_auth2_client.go - About 4 hrs to fix

        There are no issues that match your filters.

        Category
        Status