alexkappa/terraform-provider-auth0

View on GitHub

Showing 25 of 69 total issues

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

func IsURLWithNoFragment(i interface{}, k string) (warnings []string, errors []error) {

    v, ok := i.(string)
    if !ok {
        errors = append(errors, fmt.Errorf("expected type of %q to be string", k))
Severity: Major
Found in auth0/internal/validation/validation.go - About 35 mins to fix

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

    func readBranding(d *schema.ResourceData, m interface{}) error {
        api := m.(*management.Management)
        branding, err := api.Branding.Read()
        if err != nil {
            if mErr, ok := err.(management.Error); ok {
    Severity: Major
    Found in auth0/resource_auth0_branding.go - About 35 mins to fix

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

      func readOrganization(d *schema.ResourceData, m interface{}) error {
          api := m.(*management.Management)
          o, err := api.Organization.Read(d.Id())
          if err != nil {
              if mErr, ok := err.(management.Error); ok {
      Severity: Major
      Found in auth0/resource_auth0_organization.go - About 35 mins to fix

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

        func readDataClient(d *schema.ResourceData, m interface{}) error {
            clientId := auth0.StringValue(String(d, "client_id"))
            if clientId != "" {
                d.SetId(clientId)
                return readClient(d, m)
        Severity: Major
        Found in auth0/data_source_auth0_client.go - About 35 mins to fix

          Function readGuardian has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func readGuardian(d *schema.ResourceData, m interface{}) error {
              api := m.(*management.Management)
              mt, err := api.Guardian.MultiFactor.Phone.MessageTypes()
              if err != nil {
                  return err
          Severity: Minor
          Found in auth0/resource_auth0_guardian.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