chore: ensure consistent import aliasing for services and models (#10253)

To make sure that the code stays maintainable, I added the `importas` linter to ensure that the imports for models and services stay consistent.

I realised that this might be needed after finding some discrepancies between singular/plural naming, and, especially in the case of the `forgejo.org/services/context` package, multiple different aliases like `gitea_ctx`, `app_context` and `forgejo_context`. I decided for `app_context`, as that seems to be the most commonly used naming.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10253
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: nachtjasmin <nachtjasmin@posteo.de>
Co-committed-by: nachtjasmin <nachtjasmin@posteo.de>
This commit is contained in:
nachtjasmin 2025-11-30 17:00:57 +01:00 committed by Gusted
parent 993da59ad4
commit 8ee4a7d658
51 changed files with 396 additions and 359 deletions

View file

@ -9,12 +9,12 @@ import (
"forgejo.org/modules/json"
"forgejo.org/modules/private"
myCtx "forgejo.org/services/context"
app_context "forgejo.org/services/context"
"forgejo.org/services/migrations"
)
// RestoreRepo restore a repository from data
func RestoreRepo(ctx *myCtx.PrivateContext) {
func RestoreRepo(ctx *app_context.PrivateContext) {
bs, err := io.ReadAll(ctx.Req.Body)
if err != nil {
ctx.JSON(http.StatusInternalServerError, private.Response{