Commit graph

33 commits

Author SHA1 Message Date
qwerty287 f56f9cb1c0
Cleanups + prefer .yaml (#3069)
Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2024-01-11 18:43:54 +01:00
Robert Kaussow 489be65805
Remove duplicate golangci linter (#3172)
`whitespace` is listed twice
2024-01-11 18:01:24 +01:00
Robert Kaussow 7756c60a33
Enable golangci linter stylecheck (#3167)
This PR only fixes error string formatting, log message strings are
still mixed upper/lowercase (see
https://github.com/woodpecker-ci/woodpecker/pull/3161#issuecomment-1885140649)
and I'm not aware of a linter to enforce it.
2024-01-10 22:56:42 +01:00
qwerty287 12c40eb957
Enable gocritic and don't ignore globally (#3159)
Use `nolint` directives instead.

From #2960
2024-01-10 15:34:44 +01:00
qwerty287 1b380ff4b4
Enable nolintlint (#3158) 2024-01-10 12:11:18 +01:00
qwerty287 768fd71841
Enable some linters (#3129)
Mostly those that did not require much work.

From #2960

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-09 21:35:37 +01:00
qwerty287 0c05c38ddd
Move cmd/common to shared (#3092) 2023-12-31 23:29:56 +01:00
qwerty287 a37af3eeac
Add imports checks to linter (#3056)
supersedes https://github.com/woodpecker-ci/woodpecker/pull/874

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-29 21:19:42 +01:00
qwerty287 0099ff5d26
Add linting for log.Fatal() (#2946)
Closes https://github.com/woodpecker-ci/woodpecker/issues/1509
2023-12-14 10:18:14 +01:00
qwerty287 2f963d70e7
Add linting for any (#2893)
Add gofmt rules to make sure `interface{}` is not used but only `any`.
2023-11-29 20:21:18 +01:00
silverwind 872fea0e14
Remove go versions from .golangci.yml (#2775)
1. `linter.lang-version` is deprecated in favor of `run.go`
2. `run.go` defaults to the version in `go.mod` as per
[docs](https://golangci-lint.run/usage/configuration/#run-configuration):

```yaml
  # Define the Go version limit.
  # Mainly related to generics support since go1.18.
  # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18
  go: '1.19'
```

So in summary, we don't need these versions in the file as long as we
keep the version in go.mod bumped.

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-11-07 20:29:37 +01:00
Anbraten 66a5ba4e4f
Add prettier (#2600) 2023-10-24 14:42:05 +02:00
qwerty287 46273e54d8
Require Go 1.21 (#2553)
Main change are the new `maps` and `slices` stdlib packages so we can
replace `golang.org/x/exp`.
2023-10-09 09:11:08 +02:00
qwerty287 7136ca1999
Use golangci-lint to lint zerolog (#2524) 2023-10-04 15:48:56 +02:00
Martin W. Kirst 14177635b6
Update swagger API specification (#1782)
# Summary

This PR drops the outdated former swagger.yaml/json and introduced
automatic API document generation from Go code.
The generated code is also used to generate documentation/markdown for
the community page,
as well as enable the Woodpecker server to serve a Swagger Web UI for
manual tinkering.

I did opt-in for gin-swagger, a middleware for the Gin framework, to
ease implementation and have a sophisticated output.
This middleware only produces Swagger v2 specs. AFAIK the newer OpenApi
3x tooling is not yet that mature,
so I guess that's fine for now.

## Implemenation notes

- former swagger.json files removed
- former // swagger godocs removed
- introduced new dependency gin-swagger, which uses godoc annotations on
top of Gin Handler functions.
- reworked Makefile to automatically generate Go code for the server
- introduce new dependency go-swagger, to generate Markdown for
documentation purposes
- add a Swagger Web UI, incl. capabilities for manual API exploration
- consider relative root paths in the implementation
- write documentation for all exposed API endpoints
- incl. API docs in the community website (auto-generated)
- provide developer documentation, for the Woodpecker authors
- no other existing logic/code was intentionally changed

---------

close #292

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2023-06-03 21:38:36 +02:00
Lauris BH 46452fbd84
Update Go dependencies and minimal Go version to 1.20 (#1650)
Signed-off-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
2023-03-21 00:48:15 +01:00
6543 18d3139e9e
Use modern error handling and enforce it via lint (#1327)
Co-authored-by: Anbraten <anton@ju60.de>
2023-02-02 00:08:02 +01:00
6543 fecb0354bb
Update golangci-linter config (#1539)
to remove deprecated and enforce v1.19 golang syntax
2023-01-13 22:20:41 +01:00
qwerty287 8f183c82a8
Support changed files for Gitea PRs (#1342)
- add tests to fetch changed files
- ignore error if gitea version is to low
- adjust docs accordingly

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-10-28 19:17:30 +02:00
6543 acbde30c3b
Lint code with gofumpt (#664) 2022-01-06 07:44:14 +01:00
Lukas 03a4356764
Add more golangci-lint linters & sort them (#499)
close #435

Co-authored-by: 6543 <6543@obermui.de>
2021-12-01 14:43:35 +01:00
Lukas 680d003a29
Add linter revive (#554)
* Add linter revive

* Add underscore to variable name to prevent shadowing

* Remove unnecessary leading underscore

* Revert changes to vendor file

* export ConfigFetcher as interface

* no 'yoda conditions'

* rename envsubst

Co-authored-by: 6543 <6543@obermui.de>
2021-12-01 14:22:06 +01:00
Lukas 2c75a299e2
Add linter unused (#551) 2021-11-27 15:29:37 +01:00
Lukas eb134a2e27
Add linter ineffassign (#550) 2021-11-27 13:17:03 +01:00
Lukas fb333a3b1b
Add linter structcheck (#537) 2021-11-26 00:27:43 +01:00
Lukas 71485a8a3f
Add linter varcheck (#538) 2021-11-26 00:03:19 +01:00
Lukas fac0e16996
Add linter staticcheck (#535)
* Add linter staticcheck

Co-authored-by: 6543 <6543@obermui.de>
2021-11-25 17:15:36 +01:00
Lukas 116c310820
Add linter misspell (#530)
* Add linter misspell

* Fix spelling

Co-authored-by: Anbraten <anton@ju60.de>
2021-11-24 02:01:12 +01:00
Lukas 25bf91bd37
Add linter whitespace (#531) 2021-11-24 01:31:11 +01:00
6543 fe31fb1e06
Drop error only on purpose or else report back or log (#514)
- Remove Deadcode
- Simplify Code
- Drop error only on purpose
2021-11-23 15:36:52 +01:00
6543 82fd65665f
Add linter bidichk to prevent malicios utf8 chars (#516)
bidichk checks for dangerous unicode character sequences

(https://github.com/golangci/golangci-lint/pull/2330)
2021-11-16 21:07:53 +01:00
6543 86bb8f195c
format do 'simplify' and check via CI (#509)
* `make format` simplify code now

* code format

* check simplified via linter
2021-11-14 22:33:45 +01:00
Lukas c28f7cb29f
Add golangci-lint (#502)
Initial part of #435
2021-11-14 21:01:54 +01:00