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] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
indent_size = 1
[Makefile] [Makefile]
indent_style = tab indent_style = tab

View file

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

View file

@ -52,6 +52,10 @@ pipeline:
- "**/*.go" - "**/*.go"
- "go.*" - "go.*"
lint-editorconfig:
image: mstruebing/editorconfig-checker
group: test
test: test:
image: golang:1.18 image: golang:1.18
group: test 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}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. 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" . }}' 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 }}"}}") 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 }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- 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` - `drone.sqlite` -> `woodpecker.sqlite`
- Plugin Settings moved into `settings` section: - Plugin Settings moved into `settings` section:
```diff ```diff
pipline: pipline:
something: something:

View file

@ -13,14 +13,14 @@ Woodpecker uses migrations to change the database schema if a database model has
package migration package migration
import ( import (
"xorm.io/xorm" "xorm.io/xorm"
) )
var alterTableReposDropCounter = task{ var alterTableReposDropCounter = task{
name: "alter-table-drop-counter", name: "alter-table-drop-counter",
fn: func(sess *xorm.Session) error { fn: func(sess *xorm.Session) error {
return dropTableColumns(sess, "repos", "repo_counter") 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. 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 = `[ var deleteStr = `[
{ {
"proc": %q, "proc": %q,
"pos": 0, "pos": 0,
"out": "logs purged by %s on %s\n" "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 SELECT build_id FROM builds
WHERE build_repo_id = ? WHERE build_repo_id = ?
AND build_id in ( AND build_id in (
SELECT build_id SELECT build_id
FROM build_config FROM build_config
WHERE build_config.config_id = ? WHERE build_config.config_id = ?
) )
AND build_status NOT IN ('blocked', 'pending') AND build_status NOT IN ('blocked', 'pending')
LIMIT 1 LIMIT 1
`, config.RepoID, config.ID).Count() `, config.RepoID, config.ID).Count()

View file

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