Showing 7 of 7 total issues
Method dao.List
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (d *dao) List(ctx context.Context, groupIDs []uint, query *q.Query) (int, []*models.Application, error) { var ( applications []*models.Application total int64
Method dao.List
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (d *dao) List(ctx context.Context, groupIDs []uint, query *q.Query) (int, []*models.Application, error) { var ( applications []*models.Application total int64
- Read upRead up
Method dao.TransferByID
has 7 return statements (exceeds 4 allowed). Open
func (d *dao) TransferByID(ctx context.Context, id uint, groupID uint) error { currentUser, err := corecommon.UserFromContext(ctx) if err != nil { return err }
Method dao.UpdateByID
has 6 return statements (exceeds 4 allowed). Open
func (d *dao) UpdateByID(ctx context.Context, id uint, application *models.Application) (*models.Application, error) { var applicationInDB models.Application if err := d.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { // 1. get application in db first result := tx.Raw(common.ApplicationQueryByID, id).Scan(&applicationInDB)
Method dao.DeleteByID
has 5 return statements (exceeds 4 allowed). Open
func (d *dao) DeleteByID(ctx context.Context, id uint) error { currentUser, err := corecommon.UserFromContext(ctx) if err != nil { return err }
Method dao.Create
has 5 return statements (exceeds 4 allowed). Open
func (d *dao) Create(ctx context.Context, application *models.Application, extraMembers map[*usermodels.User]string) (*models.Application, error) { err := d.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { // TODO: check the group exist
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (d *dao) GetByNameFuzzily(ctx context.Context, name string, includeSoftDelete bool) ([]*models.Application, error) { var applications []*models.Application statement := d.db.Unscoped().WithContext(ctx).Where("name like ?", fmt.Sprintf("%%%s%%", name))
- Read upRead up