forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Add `lint-go-gopls` (go-gitea#30729) Make blockquote attention recognize more syntaxes (go-gitea#31240) Fix admin oauth2 custom URL settings (go-gitea#31246) Replace `gt-word-break` with `tw-break-anywhere` (go-gitea#31183) Make pasted "img" tag has the same behavior as markdown image (go-gitea#31235) Remove .segment from .project-column (go-gitea#31204) Fix overflow on push notification (go-gitea#31179) Fix NuGet Package API for $filter with Id equality (go-gitea#31188) Fix overflow on notifications (go-gitea#31178) Update chroma to v2.14.0 (go-gitea#31177) Update air package path (go-gitea#31233) Bump `@github/relative-time-element` to v4.4.1 (go-gitea#31232)
- Loading branch information
Showing
41 changed files
with
373 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ COMMA := , | |
|
||
XGO_VERSION := go-1.22.x | ||
|
||
AIR_PACKAGE ?= github.com/cosmtrek/air@v1 | ||
AIR_PACKAGE ?= github.com/air-verse/air@v1 | ||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected] | ||
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected] | ||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
@@ -36,6 +36,7 @@ XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest | |
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1 | ||
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 | ||
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1 | ||
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected] | ||
|
||
DOCKER_IMAGE ?= gitea/gitea | ||
DOCKER_TAG ?= latest | ||
|
@@ -213,6 +214,7 @@ help: | |
@echo " - lint-go lint go files" | ||
@echo " - lint-go-fix lint go files and fix issues" | ||
@echo " - lint-go-vet lint go files with vet" | ||
@echo " - lint-go-gopls lint go files with gopls" | ||
@echo " - lint-js lint js files" | ||
@echo " - lint-js-fix lint js files and fix issues" | ||
@echo " - lint-css lint css files" | ||
|
@@ -366,7 +368,7 @@ lint-frontend: lint-js lint-css | |
lint-frontend-fix: lint-js-fix lint-css-fix | ||
|
||
.PHONY: lint-backend | ||
lint-backend: lint-go lint-go-vet lint-editorconfig | ||
lint-backend: lint-go lint-go-vet lint-go-gopls lint-editorconfig | ||
|
||
.PHONY: lint-backend-fix | ||
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig | ||
|
@@ -424,6 +426,11 @@ lint-go-vet: | |
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet | ||
@$(GO) vet -vettool=gitea-vet ./... | ||
|
||
.PHONY: lint-go-gopls | ||
lint-go-gopls: | ||
@echo "Running gopls check..." | ||
@GO=$(GO) GOPLS_PACKAGE=$(GOPLS_PACKAGE) tools/lint-go-gopls.sh $(GO_SOURCES_NO_BINDATA) | ||
|
||
.PHONY: lint-editorconfig | ||
lint-editorconfig: | ||
@$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) $(EDITORCONFIG_FILES) | ||
|
@@ -864,6 +871,7 @@ deps-tools: | |
$(GO) install $(GO_LICENSES_PACKAGE) | ||
$(GO) install $(GOVULNCHECK_PACKAGE) | ||
$(GO) install $(ACTIONLINT_PACKAGE) | ||
$(GO) install $(GOPLS_PACKAGE) | ||
|
||
node_modules: package-lock.json | ||
npm install --no-save | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,8 +120,8 @@ func TestRender_CrossReferences(t *testing.T) { | |
} | ||
|
||
test( | ||
"gogits/gogs#12345", | ||
`<p><a href="`+util.URLJoin(markup.TestAppURL, "gogits", "gogs", "issues", "12345")+`" class="ref-issue" rel="nofollow">gogits/gogs#12345</a></p>`) | ||
"test-owner/test-repo#12345", | ||
`<p><a href="`+util.URLJoin(markup.TestAppURL, "test-owner", "test-repo", "issues", "12345")+`" class="ref-issue" rel="nofollow">test-owner/test-repo#12345</a></p>`) | ||
test( | ||
"go-gitea/gitea#12345", | ||
`<p><a href="`+util.URLJoin(markup.TestAppURL, "go-gitea", "gitea", "issues", "12345")+`" class="ref-issue" rel="nofollow">go-gitea/gitea#12345</a></p>`) | ||
|
@@ -530,43 +530,31 @@ func TestRender_ShortLinks(t *testing.T) { | |
} | ||
|
||
func TestRender_RelativeImages(t *testing.T) { | ||
setting.AppURL = markup.TestAppURL | ||
|
||
test := func(input, expected, expectedWiki string) { | ||
render := func(input string, isWiki bool, links markup.Links) string { | ||
buffer, err := markdown.RenderString(&markup.RenderContext{ | ||
Ctx: git.DefaultContext, | ||
Links: markup.Links{ | ||
Base: markup.TestRepoURL, | ||
BranchPath: "master", | ||
}, | ||
Metas: localMetas, | ||
}, input) | ||
assert.NoError(t, err) | ||
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer))) | ||
buffer, err = markdown.RenderString(&markup.RenderContext{ | ||
Ctx: git.DefaultContext, | ||
Links: markup.Links{ | ||
Base: markup.TestRepoURL, | ||
}, | ||
Ctx: git.DefaultContext, | ||
Links: links, | ||
Metas: localMetas, | ||
IsWiki: true, | ||
IsWiki: isWiki, | ||
}, input) | ||
assert.NoError(t, err) | ||
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(string(buffer))) | ||
return strings.TrimSpace(string(buffer)) | ||
} | ||
|
||
rawwiki := util.URLJoin(markup.TestRepoURL, "wiki", "raw") | ||
mediatree := util.URLJoin(markup.TestRepoURL, "media", "master") | ||
out := render(`<img src="LINK">`, false, markup.Links{Base: "/test-owner/test-repo"}) | ||
assert.Equal(t, `<a href="/test-owner/test-repo/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/LINK"/></a>`, out) | ||
|
||
test( | ||
`<img src="Link">`, | ||
`<img src="`+util.URLJoin(mediatree, "Link")+`"/>`, | ||
`<img src="`+util.URLJoin(rawwiki, "Link")+`"/>`) | ||
out = render(`<img src="LINK">`, true, markup.Links{Base: "/test-owner/test-repo"}) | ||
assert.Equal(t, `<a href="/test-owner/test-repo/wiki/raw/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/wiki/raw/LINK"/></a>`, out) | ||
|
||
test( | ||
`<img src="./icon.png">`, | ||
`<img src="`+util.URLJoin(mediatree, "icon.png")+`"/>`, | ||
`<img src="`+util.URLJoin(rawwiki, "icon.png")+`"/>`) | ||
out = render(`<img src="LINK">`, false, markup.Links{Base: "/test-owner/test-repo", BranchPath: "test-branch"}) | ||
assert.Equal(t, `<a href="/test-owner/test-repo/media/test-branch/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/media/test-branch/LINK"/></a>`, out) | ||
|
||
out = render(`<img src="LINK">`, true, markup.Links{Base: "/test-owner/test-repo", BranchPath: "test-branch"}) | ||
assert.Equal(t, `<a href="/test-owner/test-repo/wiki/raw/LINK" target="_blank" rel="nofollow noopener"><img src="/test-owner/test-repo/wiki/raw/LINK"/></a>`, out) | ||
|
||
out = render(`<img src="/LINK">`, true, markup.Links{Base: "/test-owner/test-repo", BranchPath: "test-branch"}) | ||
assert.Equal(t, `<img src="/LINK"/>`, out) | ||
} | ||
|
||
func Test_ParseClusterFuzz(t *testing.T) { | ||
|
@@ -719,5 +707,6 @@ func TestIssue18471(t *testing.T) { | |
func TestIsFullURL(t *testing.T) { | ||
assert.True(t, markup.IsFullURLString("https://example.com")) | ||
assert.True(t, markup.IsFullURLString("mailto:[email protected]")) | ||
assert.True(t, markup.IsFullURLString("data:image/11111")) | ||
assert.False(t, markup.IsFullURLString("/foo:bar")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.