1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-02-13 19:42:12 +02:00

Lint server & plugin for CI (#720)

* enable CI linting for server and plugin
* replace `golint` (deprecated) with `revive`
* use GH actions for lint
This commit is contained in:
Doug Lauder 2021-07-14 09:36:18 -04:00 committed by GitHub
parent 7817958aa9
commit a0524dd386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 64 additions and 14 deletions

23
.github/workflows/lint-plugin.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: golangci-lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
golangci:
name: plugin
runs-on: ubuntu-18.04
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.16
- uses: actions/checkout@v2
- name: plugin-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41
working-directory: mattermost-plugin
skip-go-installation: true

23
.github/workflows/lint-server.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: golangci-lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
golangci:
name: server
runs-on: ubuntu-18.04
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.16
- uses: actions/checkout@v2
- name: server-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41
working-directory: server
skip-go-installation: true

View File

@ -82,11 +82,12 @@ server-lint:
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
exit 1; \
fi; \
fi;
cd server; golangci-lint run ./...
cd mattermost-plugin; golangci-lint run ./...
server-test:
cd server; go test -v ./...
cd server; go test -race -v ./...
server-doc:
cd server; go doc ./...

View File

@ -18,6 +18,11 @@ linters-settings:
locale: US
lll:
line-length: 150
revive:
enableAllRules: true
rules:
- name: exported
disabled: true
linters:
disable-all: true
@ -49,7 +54,7 @@ linters:
- godot
- goerr113
- goheader
- golint
- revive
- nakedret
- gomodguard
- goprintffuncname

View File

@ -14,6 +14,11 @@ linters-settings:
- fieldalignment
lll:
line-length: 150
revive:
enableAllRules: true
rules:
- name: exported
disabled: true
linters:
disable-all: true
@ -45,7 +50,7 @@ linters:
- godot
- goerr113
- goheader
- golint
- revive
- nakedret
- gomodguard
- goprintffuncname

View File

@ -95,10 +95,7 @@ func (rd *RegisterRequest) IsValid() error {
if rd.Password == "" {
return ParamError{"password is required"}
}
if err := isValidPassword(rd.Password); err != nil {
return err
}
return nil
return isValidPassword(rd.Password)
}
// ChangePasswordRequest is a user password change request
@ -121,11 +118,7 @@ func (rd *ChangePasswordRequest) IsValid() error {
if rd.NewPassword == "" {
return ParamError{"new password is required"}
}
if err := isValidPassword(rd.NewPassword); err != nil {
return err
}
return nil
return isValidPassword(rd.NewPassword)
}
func isValidPassword(password string) error {

View File

@ -19,7 +19,7 @@ var versions = []string{
}
var (
CurrentVersion string = versions[0]
CurrentVersion = versions[0]
BuildNumber string
BuildDate string
BuildHash string