Functions prefixed with Get should return a value RVV-A0006
Anti-pattern
Major
22 occurrences in this check
function 'getInfoRefs' seems to be a getter but it does not return any result
317	return []byte(s + str)
318}
319
320func getInfoRefs(h serviceHandler) {321	h.setHeaderNoCache()
322	service := getServiceType(h.r)
323	if service != "upload-pack" && service != "receive-pack" {
function 'getTextFile' seems to be a getter but it does not return any result
334	_, _ = h.w.Write(refs)
335}
336
337func getTextFile(h serviceHandler) {338	h.setHeaderNoCache()
339	h.sendFile("text/plain")
340}
function 'getInfoPacks' seems to be a getter but it does not return any result
339	h.sendFile("text/plain")
340}
341
342func getInfoPacks(h serviceHandler) {343	h.setHeaderCacheForever()
344	h.sendFile("text/plain; charset=utf-8")
345}
function 'getLooseObject' seems to be a getter but it does not return any result
344	h.sendFile("text/plain; charset=utf-8")
345}
346
347func getLooseObject(h serviceHandler) {348	h.setHeaderCacheForever()
349	h.sendFile("application/x-git-loose-object")
350}
function 'getPackFile' seems to be a getter but it does not return any result
349	h.sendFile("application/x-git-loose-object")
350}
351
352func getPackFile(h serviceHandler) {353	h.setHeaderCacheForever()
354	h.sendFile("application/x-git-packed-objects")
355}
function 'getIdxFile' seems to be a getter but it does not return any result
354	h.sendFile("application/x-git-packed-objects")
355}
356
357func getIdxFile(h serviceHandler) {358	h.setHeaderCacheForever()
359	h.sendFile("application/x-git-packed-objects-toc")
360}
function 'GetAuthenticatedUser' seems to be a getter but it does not return any result
61	c.JSONSuccess(u.APIFormat())
62}
63
64func GetAuthenticatedUser(c *context.APIContext) {65	c.JSONSuccess(c.User.APIFormat())
66}
function 'GetInfo' seems to be a getter but it does not return any result
47	})
48}
49
50func GetInfo(c *context.APIContext) {51	u, err := db.Users.GetByUsername(c.Req.Context(), c.Params(":username"))
52	if err != nil {
53		c.NotFoundOrError(err, "get user by name")
function 'GetPublicKey' seems to be a getter but it does not return any result
 63	listPublicKeys(c, user.ID)
 64}
 65
 66func GetPublicKey(c *context.APIContext) { 67	key, err := db.GetPublicKeyByID(c.ParamsInt64(":id"))
 68	if err != nil {
 69		c.NotFoundOrError(err, "get public key by ID")
function 'GetRepoGitTree' seems to be a getter but it does not return any result
13	"gogs.io/gogs/internal/gitutil"
14)
15
16func GetRepoGitTree(c *context.APIContext) {17	gitRepo, err := git.Open(c.Repo.Repository.RepoPath())
18	if err != nil {
19		c.Error(err, "open repository")
function 'GetMilestone' seems to be a getter but it does not return any result
28	c.JSONSuccess(&apiMilestones)
29}
30
31func GetMilestone(c *context.APIContext) {32	milestone, err := db.GetMilestoneByRepoID(c.Repo.Repository.ID, c.ParamsInt64(":id"))
33	if err != nil {
34		c.NotFoundOrError(err, "get milestone by repository ID")
function 'GetLabel' seems to be a getter but it does not return any result
28	c.JSONSuccess(&apiLabels)
29}
30
31func GetLabel(c *context.APIContext) {32	var label *db.Label
33	var err error
34	idStr := c.Params(":id")
function 'GetDeployKey' seems to be a getter but it does not return any result
 42}
 43
 44// https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#get-a-deploy-key
 45func GetDeployKey(c *context.APIContext) { 46	key, err := db.GetDeployKeyByID(c.ParamsInt64(":id"))
 47	if err != nil {
 48		c.NotFoundOrError(err, "get deploy key by ID")
function 'GetIssue' seems to be a getter but it does not return any result
 63	listIssues(c, &opts)
 64}
 65
 66func GetIssue(c *context.APIContext) { 67	issue, err := db.GetIssueByIndex(c.Repo.Repository.ID, c.ParamsInt64(":index"))
 68	if err != nil {
 69		c.NotFoundOrError(err, "get issue by index")
function 'GetArchive' seems to be a getter but it does not return any result
34	}
35}
36
37func GetArchive(c *context.APIContext) {38	repoPath := db.RepoPath(c.Params(":username"), c.Params(":reponame"))
39	gitRepo, err := git.Open(repoPath)
40	if err != nil {
function 'GetEditorconfig' seems to be a getter but it does not return any result
46	repo.Download(c.Context)
47}
48
49func GetEditorconfig(c *context.APIContext) {50	ec, err := c.Repo.Editorconfig()
51	if err != nil {
52		c.NotFoundOrError(gitutil.NewError(err), "get .editorconfig")
function 'GetRawFile' seems to be a getter but it does not return any result
13	"gogs.io/gogs/internal/route/repo"
14)
15
16func GetRawFile(c *context.APIContext) {17	if !c.Repo.HasAccess() {
18		c.NotFound()
19		return
function 'GetContents' seems to be a getter but it does not return any result
101	return content, nil
102}
103
104func GetContents(c *context.APIContext) {105	repoPath := repoutil.RepositoryPath(c.Params(":username"), c.Params(":reponame"))
106	gitRepo, err := git.Open(repoPath)
107	if err != nil {
function 'GetReferenceSHA' seems to be a getter but it does not return any result
 77	c.JSONSuccess(apiCommit)
 78}
 79
 80func GetReferenceSHA(c *context.APIContext) { 81	gitRepo, err := git.Open(c.Repo.Repository.RepoPath())
 82	if err != nil {
 83		c.Error(err, "open repository")
function 'GetSingleCommit' seems to be a getter but it does not return any result
 52}
 53
 54// GetSingleCommit will return a single Commit object based on the specified SHA.
 55func GetSingleCommit(c *context.APIContext) { 56	if strings.Contains(c.Req.Header.Get("Accept"), api.MediaApplicationSHA) {
 57		c.SetParams("*", c.Params(":sha"))
 58		GetReferenceSHA(c)
function 'GetAllCommits' seems to be a getter but it does not return any result
 19)
 20
 21// GetAllCommits returns a slice of commits starting from HEAD.
 22func GetAllCommits(c *context.APIContext) { 23	// Get pagesize, set default if it is not specified.
 24	pageSize := c.QueryInt("pageSize")
 25	if pageSize == 0 {
function 'GetBranch' seems to be a getter but it does not return any result
12)
13
14// https://github.com/gogs/go-gogs-client/wiki/Repositories#get-branch
15func GetBranch(c *context.APIContext) {16	branch, err := c.Repo.Repository.GetBranch(c.Params("*"))
17	if err != nil {
18		c.NotFoundOrError(err, "get branch")