vshn/appuio-keycloak-adapter

View on GitHub

Showing 10 of 14 total issues

Function main has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {
    metricsAddr := flag.String("metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
    enableLeaderElection := flag.Bool("leader-elect", false,
        "Enable leader election for controller manager. "+
            "Enabling this will ensure there is only one active controller manager.")
Severity: Minor
Found in main.go - About 1 hr to fix

    Method Client.PutGroup has 52 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c Client) PutGroup(ctx context.Context, group Group) (Group, error) {
        res := NewGroup(group.displayName, group.path...)
        group = c.prependRoot(group)
    
        token, err := c.login(ctx)
    Severity: Minor
    Found in keycloak/client.go - About 1 hr to fix

      Method Client.ListGroups has 8 return statements (exceeds 4 allowed).
      Open

      func (c Client) ListGroups(ctx context.Context) ([]Group, error) {
          token, err := c.login(ctx)
          if err != nil {
              return nil, fmt.Errorf("failed binding to keycloak: %w", err)
          }
      Severity: Major
      Found in keycloak/client.go - About 50 mins to fix

        Method OrganizationReconciler.Reconcile has 7 return statements (exceeds 4 allowed).
        Open

        func (r *OrganizationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
            log := log.FromContext(ctx)
            log.V(4).WithValues("request", req).Info("Reconciling")
        
            log.V(4).Info("Getting Organization and Members..")
        Severity: Major
        Found in controllers/organization_controller.go - About 45 mins to fix

          Function setupManager has 7 return statements (exceeds 4 allowed).
          Open

          func setupManager(kc controllers.KeycloakClient, syncRoles []string, syncRolesUserPrefix string, opt ctrl.Options) (ctrl.Manager, *controllers.PeriodicSyncer, error) {
              mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), opt)
              if err != nil {
                  return nil, nil, err
              }
          Severity: Major
          Found in main.go - About 45 mins to fix

            Method TeamReconciler.Reconcile has 6 return statements (exceeds 4 allowed).
            Open

            func (r *TeamReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
                log := log.FromContext(ctx)
                log.V(4).WithValues("request", req).Info("Reconciling")
            
                log.V(4).Info("Getting the Team..")
            Severity: Major
            Found in controllers/team_controller.go - About 40 mins to fix

              Method Client.getGroup has 6 return statements (exceeds 4 allowed).
              Open

              func (c Client) getGroup(ctx context.Context, token *gocloak.JWT, toSearch Group) (*gocloak.Group, error) {
                  if len(toSearch.PathMembers()) == 0 {
                      return nil, nil
                  }
                  // This may return more than one 1 result
              Severity: Major
              Found in keycloak/client.go - About 40 mins to fix

                Method Client.PutGroup has 6 return statements (exceeds 4 allowed).
                Open

                func (c Client) PutGroup(ctx context.Context, group Group) (Group, error) {
                    res := NewGroup(group.displayName, group.path...)
                    group = c.prependRoot(group)
                
                    token, err := c.login(ctx)
                Severity: Major
                Found in keycloak/client.go - About 40 mins to fix

                  Method PeriodicSyncer.syncOrganization has 5 return statements (exceeds 4 allowed).
                  Open

                  func (r *PeriodicSyncer) syncOrganization(ctx context.Context, g keycloak.Group, org *orgv1.Organization) (*orgv1.Organization, error) {
                      logger := log.FromContext(ctx)
                      var err error
                  
                      if org == nil {
                  Severity: Major
                  Found in controllers/periodic_syncer.go - About 35 mins to fix

                    Method Client.filterTreeWithRoot has 5 return statements (exceeds 4 allowed).
                    Open

                    func (c Client) filterTreeWithRoot(groups []*gocloak.Group) []gocloak.Group {
                        if c.RootGroup == "" {
                            rootGroups := make([]gocloak.Group, len(groups))
                            for i := range groups {
                                rootGroups[i] = *groups[i]
                    Severity: Major
                    Found in keycloak/client.go - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language