Use editorconfig-checker (#982)

This commit is contained in:
6543 2022-06-17 12:03:34 +02:00 committed by GitHub
parent 14b3cfff1b
commit 08479390ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 41 deletions

14
.ecrc Normal file
View File

@ -0,0 +1,14 @@
{
"Exclude": [
".git",
"go.mod", "go.sum",
"vendor",
"fixtures",
"LICENSE",
"node_modules",
"server/store/datastore/migration/testfiles/sqlite.db",
"server/store/datastore/feed.go",
"_test.go",
"Makefile"
]
}

View File

@ -14,6 +14,7 @@ indent_style = tab
[*.md]
trim_trailing_whitespace = false
indent_size = 1
[Makefile]
indent_style = tab

View File

@ -8,8 +8,8 @@ pipeline:
when:
event: [push, pull_request]
path:
- "docs/**"
- ".woodpecker/docs.yml"
- "docs/**"
- ".woodpecker/docs.yml"
deploy-preview:
image: woodpeckerci/plugin-surge-preview:next
@ -24,8 +24,8 @@ pipeline:
when:
event: pull_request
path:
- "docs/**"
- ".woodpecker/docs.yml"
- "docs/**"
- ".woodpecker/docs.yml"
# TODO: add step to remove preview again after PR is closed (waiting for #286)
deploy:
@ -53,6 +53,6 @@ pipeline:
event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
path:
- "docs/**"
- ".woodpecker/docs.yml"
- "docs/**"
- ".woodpecker/docs.yml"

View File

@ -52,6 +52,10 @@ pipeline:
- "**/*.go"
- "go.*"
lint-editorconfig:
image: mstruebing/editorconfig-checker
group: test
test:
image: golang:1.18
group: test

View File

@ -10,8 +10,8 @@
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "woodpecker-server.fullname" . }}'
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "woodpecker-server.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "woodpecker-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}

View File

@ -60,6 +60,7 @@ Some versions need some changes to the server configuration or the pipeline conf
- `drone.sqlite` -> `woodpecker.sqlite`
- Plugin Settings moved into `settings` section:
```diff
pipline:
something:

View File

@ -13,14 +13,14 @@ Woodpecker uses migrations to change the database schema if a database model has
package migration
import (
"xorm.io/xorm"
"xorm.io/xorm"
)
var alterTableReposDropCounter = task{
name: "alter-table-drop-counter",
fn: func(sess *xorm.Session) error {
return dropTableColumns(sess, "repos", "repo_counter")
},
name: "alter-table-drop-counter",
fn: func(sess *xorm.Session) error {
return dropTableColumns(sess, "repos", "repo_counter")
},
}
```
@ -33,4 +33,3 @@ You should not use `sess.Begin()`, `sess.Commit()` or `sess.Close()` inside a mi
:::
To automatically execute the migration after the start of the server, the new migration needs to be added to the end of `migrationTasks` in `server/store/datastore/migration/migration.go`. After a successful execution of that transaction the server will automatically add the migration to a list, so it won't be executed again on the next start.

View File

@ -380,8 +380,8 @@ func DeleteBuildLogs(c *gin.Context) {
var deleteStr = `[
{
"proc": %q,
"pos": 0,
"out": "logs purged by %s on %s\n"
"proc": %q,
"pos": 0,
"out": "logs purged by %s on %s\n"
}
]`

View File

@ -52,10 +52,10 @@ func (s storage) ConfigFindApproved(config *model.Config) (bool, error) {
SELECT build_id FROM builds
WHERE build_repo_id = ?
AND build_id in (
SELECT build_id
FROM build_config
WHERE build_config.config_id = ?
)
SELECT build_id
FROM build_config
WHERE build_config.config_id = ?
)
AND build_status NOT IN ('blocked', 'pending')
LIMIT 1
`, config.RepoID, config.ID).Count()

View File

@ -2,34 +2,34 @@
```Go
import (
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"golang.org/x/oauth2"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"golang.org/x/oauth2"
)
const (
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
host = "http://woodpecker.company.tld"
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
host = "http://woodpecker.company.tld"
)
func main() {
// create an http client with oauth authentication.
config := new(oauth2.Config)
authenticator := config.Client(
oauth2.NoContext,
&oauth2.Token{
AccessToken: token,
},
)
// create an http client with oauth authentication.
config := new(oauth2.Config)
authenticator := config.Client(
oauth2.NoContext,
&oauth2.Token{
AccessToken: token,
},
)
// create the woodpecker client with authenticator
client := woodpecker.NewClient(host, authenticator)
// create the woodpecker client with authenticator
client := woodpecker.NewClient(host, authenticator)
// gets the current user
user, err := client.Self()
fmt.Println(user, err)
// gets the current user
user, err := client.Self()
fmt.Println(user, err)
// gets the named repository information
repo, err := client.Repo("woodpecker-ci", "woodpecker")
fmt.Println(repo, err)
// gets the named repository information
repo, err := client.Repo("woodpecker-ci", "woodpecker")
fmt.Println(repo, err)
}
```