Add editorconfig, fix files and lint via ci

This commit is contained in:
6543 2022-11-11 23:51:45 +01:00
parent 91b54bef29
commit 8e67d28c4f
No known key found for this signature in database
GPG Key ID: B8BE6D610E61C862
9 changed files with 41 additions and 12 deletions

9
.ecrc Normal file
View File

@ -0,0 +1,9 @@
{
"Exclude": [
".git",
"go.mod", "go.sum",
"vendor",
"LICENSE",
"_test.go"
]
}

17
.editorconfig Normal file
View File

@ -0,0 +1,17 @@
root = true
[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.go]
indent_style = tab
[*.md]
trim_trailing_whitespace = false
indent_size = 1

View File

@ -15,6 +15,10 @@ pipeline:
- "[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }" - "[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }"
- golangci-lint run --timeout 5m --build-tags integration - golangci-lint run --timeout 5m --build-tags integration
editor-config:
group: compliant
image: mstruebing/editorconfig-checker
build: build:
group: compliant group: compliant
image: codeberg.org/6543/docker-images/golang_just image: codeberg.org/6543/docker-images/golang_just

View File

@ -18,6 +18,7 @@ build-tag VERSION:
lint: tool-golangci tool-gofumpt lint: tool-golangci tool-gofumpt
[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }; \ [ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }; \
golangci-lint run --timeout 5m --build-tags integration golangci-lint run --timeout 5m --build-tags integration
# TODO: run editorconfig-checker
fmt: tool-gofumpt fmt: tool-gofumpt
gofumpt -w --extra . gofumpt -w --extra .

View File

@ -8,7 +8,6 @@ It is suitable to be deployed by other Gitea instances, too, to offer static pag
**End user documentation** can mainly be found at the [Wiki](https://codeberg.org/Codeberg/pages-server/wiki/Overview) **End user documentation** can mainly be found at the [Wiki](https://codeberg.org/Codeberg/pages-server/wiki/Overview)
and the [Codeberg Documentation](https://docs.codeberg.org/codeberg-pages/). and the [Codeberg Documentation](https://docs.codeberg.org/codeberg-pages/).
## Quickstart ## Quickstart
This is the new Codeberg Pages server, a solution for serving static pages from Gitea repositories. This is the new Codeberg Pages server, a solution for serving static pages from Gitea repositories.
@ -20,17 +19,16 @@ first line will be the canonical domain/URL; all other occurrences will be redir
2) add a CNAME entry to your domain, pointing to `[[{branch}.]{repo}.]{owner}.codeberg.page` (repo defaults to 2) add a CNAME entry to your domain, pointing to `[[{branch}.]{repo}.]{owner}.codeberg.page` (repo defaults to
"pages", "branch" defaults to the default branch if "repo" is "pages", or to "pages" if "repo" is something else. "pages", "branch" defaults to the default branch if "repo" is "pages", or to "pages" if "repo" is something else.
If the branch name contains slash characters, you need to replace "/" in the branch name to "~"): If the branch name contains slash characters, you need to replace "/" in the branch name to "~"):
`www.example.org. IN CNAME main.pages.example.codeberg.page.` `www.example.org. IN CNAME main.pages.example.codeberg.page.`
3) if a CNAME is set for "www.example.org", you can redirect there from the naked domain by adding an ALIAS record 3) if a CNAME is set for "www.example.org", you can redirect there from the naked domain by adding an ALIAS record
for "example.org" (if your provider allows ALIAS or similar records, otherwise use A/AAAA), together with a TXT for "example.org" (if your provider allows ALIAS or similar records, otherwise use A/AAAA), together with a TXT
record that points to your repo (just like the CNAME record): record that points to your repo (just like the CNAME record):
`example.org IN ALIAS codeberg.page.` `example.org IN ALIAS codeberg.page.`
`example.org IN TXT main.pages.example.codeberg.page.` `example.org IN TXT main.pages.example.codeberg.page.`
Certificates are generated, updated and cleaned up automatically via Let's Encrypt through a TLS challenge. Certificates are generated, updated and cleaned up automatically via Let's Encrypt through a TLS challenge.
## Deployment ## Deployment
**Warning: Some Caveats Apply** **Warning: Some Caveats Apply**

View File

@ -23,11 +23,11 @@
<body> <body>
<i class="fa fa-search text-primary" style="font-size: 96px;"></i> <i class="fa fa-search text-primary" style="font-size: 96px;"></i>
<h1 class="mb-0 text-primary"> <h1 class="mb-0 text-primary">
Page not found! Page not found!
</h1> </h1>
<h5 class="text-center" style="max-width: 25em;"> <h5 class="text-center" style="max-width: 25em;">
Sorry, but this page couldn't be found or is inaccessible (%status).<br/> Sorry, but this page couldn't be found or is inaccessible (%status).<br/>
We hope this isn't a problem on our end ;) - Make sure to check the <a href="https://docs.codeberg.org/codeberg-pages/troubleshooting/" target="_blank">troubleshooting section in the Docs</a>! We hope this isn't a problem on our end ;) - Make sure to check the <a href="https://docs.codeberg.org/codeberg-pages/troubleshooting/" target="_blank">troubleshooting section in the Docs</a>!
</h5> </h5>
<small class="text-muted"> <small class="text-muted">
<img src="https://design.codeberg.org/logo-kit/icon.svg" class="align-top"> <img src="https://design.codeberg.org/logo-kit/icon.svg" class="align-top">