ory-am/hydra

View on GitHub

Showing 403 of 850 total issues

Function claimsFromVCResponse has 5 return statements (exceeds 4 allowed).
Open

func claimsFromVCResponse(t *testing.T, reg driver.Registry, vc *hydraoauth2.VerifiableCredentialResponse) (*jwt.Token, *hydraoauth2.VerifableCredentialClaims) {
    ctx := context.Background()
    token, err := jwt.ParseWithClaims(vc.Credential, new(hydraoauth2.VerifableCredentialClaims), func(token *jwt.Token) (interface{}, error) {
        kid, found := token.Header["kid"]
        if !found {
Severity: Major
Found in oauth2/oauth2_auth_code_test.go - About 35 mins to fix

    Method Duration.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
    Open

    func (ns *Duration) UnmarshalJSON(data []byte) error {
        if ns == nil {
            return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
        }
    
    
    Severity: Major
    Found in x/sqlx.go - About 35 mins to fix

      Method Handler.createVerifiableCredential has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      Open

      func (h *Handler) createVerifiableCredential(w http.ResponseWriter, r *http.Request) {
          ctx := r.Context()
          session := NewSessionWithCustomClaims(ctx, h.c, "")
          accessToken := fosite.AccessTokenFromRequest(r)
          tokenType, _, err := h.r.OAuth2Provider().IntrospectToken(ctx, accessToken, fosite.AccessToken, session)
      Severity: Minor
      Found in oauth2/handler.go - About 25 mins 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

      Severity
      Category
      Status
      Source
      Language