sahat/satellizer

View on GitHub
examples/server/go/oauth2.go

Summary

Maintainability
C
1 day
Test Coverage

Function LoginWithFacebook has 94 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func LoginWithFacebook(w http.ResponseWriter, r *http.Request) {
    apiUrl := "https://graph.facebook.com"
    accessTokenPath := "/v2.3/oauth/access_token"
    graphApiPath := "/v2.3/me"

Severity: Major
Found in examples/server/go/oauth2.go - About 2 hrs to fix

    Function LoginWithGoogle has 93 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func LoginWithGoogle(w http.ResponseWriter, r *http.Request) {
    
        accessTokenUrl := "https://accounts.google.com/o/oauth2/token"
        peopleApiUrl := "https://www.googleapis.com"
        peopleApiPath := "/plus/v1/people/me/openIdConnect"
    Severity: Major
    Found in examples/server/go/oauth2.go - About 2 hrs to fix

      Function LoginWithFacebook has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
      Open

      func LoginWithFacebook(w http.ResponseWriter, r *http.Request) {
          apiUrl := "https://graph.facebook.com"
          accessTokenPath := "/v2.3/oauth/access_token"
          graphApiPath := "/v2.3/me"
      
      
      Severity: Minor
      Found in examples/server/go/oauth2.go - About 1 hr 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

      Function LoginWithGoogle has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
      Open

      func LoginWithGoogle(w http.ResponseWriter, r *http.Request) {
      
          accessTokenUrl := "https://accounts.google.com/o/oauth2/token"
          peopleApiUrl := "https://www.googleapis.com"
          peopleApiPath := "/plus/v1/people/me/openIdConnect"
      Severity: Minor
      Found in examples/server/go/oauth2.go - About 1 hr 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

      Function LoginWithGoogle has 9 return statements (exceeds 4 allowed).
      Open

      func LoginWithGoogle(w http.ResponseWriter, r *http.Request) {
      
          accessTokenUrl := "https://accounts.google.com/o/oauth2/token"
          peopleApiUrl := "https://www.googleapis.com"
          peopleApiPath := "/plus/v1/people/me/openIdConnect"
      Severity: Major
      Found in examples/server/go/oauth2.go - About 55 mins to fix

        Function LoginWithFacebook has 9 return statements (exceeds 4 allowed).
        Open

        func LoginWithFacebook(w http.ResponseWriter, r *http.Request) {
            apiUrl := "https://graph.facebook.com"
            accessTokenPath := "/v2.3/oauth/access_token"
            graphApiPath := "/v2.3/me"
        
        
        Severity: Major
        Found in examples/server/go/oauth2.go - About 55 mins to fix

          There are no issues that match your filters.

          Category
          Status