You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-15 23:54:29 +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:
23
.github/workflows/lint-plugin.yml
vendored
Normal file
23
.github/workflows/lint-plugin.yml
vendored
Normal 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
23
.github/workflows/lint-server.yml
vendored
Normal 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
|
5
Makefile
5
Makefile
@ -82,11 +82,12 @@ server-lint:
|
|||||||
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
|
@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."; \
|
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi; \
|
fi;
|
||||||
cd server; golangci-lint run ./...
|
cd server; golangci-lint run ./...
|
||||||
|
cd mattermost-plugin; golangci-lint run ./...
|
||||||
|
|
||||||
server-test:
|
server-test:
|
||||||
cd server; go test -v ./...
|
cd server; go test -race -v ./...
|
||||||
|
|
||||||
server-doc:
|
server-doc:
|
||||||
cd server; go doc ./...
|
cd server; go doc ./...
|
||||||
|
@ -18,6 +18,11 @@ linters-settings:
|
|||||||
locale: US
|
locale: US
|
||||||
lll:
|
lll:
|
||||||
line-length: 150
|
line-length: 150
|
||||||
|
revive:
|
||||||
|
enableAllRules: true
|
||||||
|
rules:
|
||||||
|
- name: exported
|
||||||
|
disabled: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
@ -49,7 +54,7 @@ linters:
|
|||||||
- godot
|
- godot
|
||||||
- goerr113
|
- goerr113
|
||||||
- goheader
|
- goheader
|
||||||
- golint
|
- revive
|
||||||
- nakedret
|
- nakedret
|
||||||
- gomodguard
|
- gomodguard
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
|
@ -14,6 +14,11 @@ linters-settings:
|
|||||||
- fieldalignment
|
- fieldalignment
|
||||||
lll:
|
lll:
|
||||||
line-length: 150
|
line-length: 150
|
||||||
|
revive:
|
||||||
|
enableAllRules: true
|
||||||
|
rules:
|
||||||
|
- name: exported
|
||||||
|
disabled: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
@ -45,7 +50,7 @@ linters:
|
|||||||
- godot
|
- godot
|
||||||
- goerr113
|
- goerr113
|
||||||
- goheader
|
- goheader
|
||||||
- golint
|
- revive
|
||||||
- nakedret
|
- nakedret
|
||||||
- gomodguard
|
- gomodguard
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
|
@ -95,10 +95,7 @@ func (rd *RegisterRequest) IsValid() error {
|
|||||||
if rd.Password == "" {
|
if rd.Password == "" {
|
||||||
return ParamError{"password is required"}
|
return ParamError{"password is required"}
|
||||||
}
|
}
|
||||||
if err := isValidPassword(rd.Password); err != nil {
|
return isValidPassword(rd.Password)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangePasswordRequest is a user password change request
|
// ChangePasswordRequest is a user password change request
|
||||||
@ -121,11 +118,7 @@ func (rd *ChangePasswordRequest) IsValid() error {
|
|||||||
if rd.NewPassword == "" {
|
if rd.NewPassword == "" {
|
||||||
return ParamError{"new password is required"}
|
return ParamError{"new password is required"}
|
||||||
}
|
}
|
||||||
if err := isValidPassword(rd.NewPassword); err != nil {
|
return isValidPassword(rd.NewPassword)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func isValidPassword(password string) error {
|
func isValidPassword(password string) error {
|
||||||
|
@ -19,7 +19,7 @@ var versions = []string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CurrentVersion string = versions[0]
|
CurrentVersion = versions[0]
|
||||||
BuildNumber string
|
BuildNumber string
|
||||||
BuildDate string
|
BuildDate string
|
||||||
BuildHash string
|
BuildHash string
|
||||||
|
Reference in New Issue
Block a user