Functions prefixed with Get should return a value RVV-A0006
Anti-pattern
Major
3 months ago3 years old
function 'GetStoresByState' seems to be a getter but it does not return any result
672// @Success  200  {object}  response.StoresInfo
673// @Failure  500  {string}  string  "PD server failed to proceed the request."
674// @Router   /stores/check [get]
675func (h *storesHandler) GetStoresByState(w http.ResponseWriter, r *http.Request) {676	rc := getCluster(r)
677	stores := rc.GetMetaStores()
678	StoresInfo := &response.StoresInfo{
function 'GetAllStores' seems to be a getter but it does not return any result
635// @Failure  500  {string}  string  "PD server failed to proceed the request."
636// @Router      /stores [get]
637// @Deprecated  Better to use /stores/check instead.
638func (h *storesHandler) GetAllStores(w http.ResponseWriter, r *http.Request) {639	rc := getCluster(r)
640	stores := rc.GetMetaStores()
641	StoresInfo := &response.StoresInfo{
function 'GetStoresProgress' seems to be a getter but it does not return any result
584// @Failure  400  {string}  string  "The input is invalid."
585// @Failure  500  {string}  string  "PD server failed to proceed the request."
586// @Router   /stores/progress [get]
587func (h *storesHandler) GetStoresProgress(w http.ResponseWriter, r *http.Request) {588	if v := r.URL.Query().Get("id"); v != "" {
589		storeID, err := strconv.ParseUint(v, 10, 64)
590		if err != nil {
function 'GetStoreLimitScene' seems to be a getter but it does not return any result
557// @Produce  json
558// @Success  200  {string}  string  "Get store limit scene successfully."
559// @Router   /stores/limit/scene [get]
560func (h *storesHandler) GetStoreLimitScene(w http.ResponseWriter, r *http.Request) {561	typeName := r.URL.Query().Get("type")
562	typeValue, err := parseStoreLimitType(typeName)
563	if err != nil {
function 'GetAllStoresLimit' seems to be a getter but it does not return any result
496// @Success  200  {object}  string
497// @Failure  500  {string}  string  "PD server failed to proceed the request."
498// @Router   /stores/limit [get]
499func (h *storesHandler) GetAllStoresLimit(w http.ResponseWriter, r *http.Request) {500	cfg := h.GetScheduleConfig()
501	if version := cfg.StoreLimitVersion; version != storelimit.VersionV1 {
502		h.rd.JSON(w, http.StatusBadRequest, fmt.Sprintf("current store limit version:%s not support get limit", version))