Skip to content

Commit

Permalink
Merge remote-tracking branch 'github-bk-bcs/master'
Browse files Browse the repository at this point in the history
* github-bk-bcs/master:
  Update: add bcs-lint.yml (#2576)
  • Loading branch information
wenxinlee2015 committed Sep 18, 2023
2 parents fdcbb03 + 7d94b16 commit 22e165a
Show file tree
Hide file tree
Showing 40 changed files with 477 additions and 94 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: lint
on: [push, pull_request]
jobs:
bcs-webconsole:
name: bcs-webconsole
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v3
with:
go-version-file: bcs-services/bcs-webconsole/go.mod
- name: go mod tidy check
uses: katexochen/go-tidy-check@v2
with:
modules: bcs-services/bcs-webconsole
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
args: --timeout=30m --issues-exit-code=0
working-directory: bcs-services/bcs-webconsole
bcs-monitor:
name: bcs-monitor
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v3
with:
go-version-file: bcs-services/bcs-monitor/go.mod
- name: go mod tidy check
uses: katexochen/go-tidy-check@v2
with:
modules: bcs-services/bcs-monitor
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
args: --timeout=30m --issues-exit-code=0
working-directory: bcs-services/bcs-monitor
bcs-bscp:
name: bcs-bscp
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v3
with:
go-version-file: bcs-services/bcs-bscp/go.mod
- name: go mod tidy check
uses: katexochen/go-tidy-check@v2
with:
modules: bcs-services/bcs-bscp
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
args: --timeout=30m --issues-exit-code=0
working-directory: bcs-services/bcs-bscp
35 changes: 0 additions & 35 deletions .golangci.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
run:
timeout: 5m

issues:
# 显示所有 issue
max-issues-per-linter: 0
max-same-issues: 0
exclude-use-default: false

linters:
disable-all: true
enable:
# enable by default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused

# custom
- goconst
- gocyclo
- gofmt
- goheader
- goimports
- gosec
- misspell
- nakedret
- revive
- unconvert
- unparam

linters-settings:
# 只开启特定的规则
errcheck:
exclude-functions:
- (*os.File).Close
- (io.Closer).Close
- os.RemoveAll
govet:
check-shadowing: true
gocyclo:
min-complexity: 30
gosec:
includes:
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G101 # Look for hard coded credentials
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G504 # Import blocklist: net/http/cgi
goheader:
template: |-
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
misspell:
locale: US
revive:
rules:
- name: exported
severity: warning
disabled: false
arguments:
- checkPrivateReceivers
- sayRepetitiveInsteadOfStutters
- name: package-comments
severity: warning
disabled: false
89 changes: 89 additions & 0 deletions bcs-services/bcs-bscp/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
run:
timeout: 5m

issues:
# 显示所有 issue
max-issues-per-linter: 0
max-same-issues: 0
exclude-use-default: false

linters:
disable-all: true
enable:
# enable by default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused

# custom
- gci
- goconst
- gocyclo
- gofmt
- goheader
- goimports
- gosec
- misspell
- nakedret
- revive
- unconvert
- unparam

linters-settings:
# 只开启特定的规则
errcheck:
exclude-functions:
- (*os.File).Close
- (io.Closer).Close
- (net/http.ResponseWriter).Write
- io.Copy
- os.RemoveAll
govet:
check-shadowing: true
gocyclo:
min-complexity: 30
goimports:
local-prefixes: bscp.io
gci:
sections:
- standard
- default
- prefix(bscp.io)
gosec:
includes:
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G101 # Look for hard coded credentials
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G504 # Import blocklist: net/http/cgi
goheader:
template: |-
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
misspell:
locale: US
revive:
rules:
- name: exported
severity: warning
disabled: false
arguments:
- checkPrivateReceivers
- sayRepetitiveInsteadOfStutters
- name: package-comments
severity: warning
disabled: false
89 changes: 89 additions & 0 deletions bcs-services/bcs-monitor/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
run:
timeout: 5m

issues:
# 显示所有 issue
max-issues-per-linter: 0
max-same-issues: 0
exclude-use-default: false

linters:
disable-all: true
enable:
# enable by default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused

# custom
- gci
- goconst
- gocyclo
- gofmt
- goheader
- goimports
- gosec
- misspell
- nakedret
- revive
- unconvert
- unparam

linters-settings:
# 只开启特定的规则
errcheck:
exclude-functions:
- (*os.File).Close
- (io.Closer).Close
- (net/http.ResponseWriter).Write
- io.Copy
- os.RemoveAll
govet:
check-shadowing: true
gocyclo:
min-complexity: 30
goimports:
local-prefixes: github.com/Tencent/bk-bcs/bcs-services/bcs-monitor
gci:
sections:
- standard
- default
- prefix(github.com/Tencent/bk-bcs/bcs-services/bcs-monitor)
gosec:
includes:
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G101 # Look for hard coded credentials
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G504 # Import blocklist: net/http/cgi
goheader:
template: |-
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
misspell:
locale: US
revive:
rules:
- name: exported
severity: warning
disabled: false
arguments:
- checkPrivateReceivers
- sayRepetitiveInsteadOfStutters
- name: package-comments
severity: warning
disabled: false
21 changes: 0 additions & 21 deletions bcs-services/bcs-monitor/.promu.yml

This file was deleted.

4 changes: 4 additions & 0 deletions bcs-services/bcs-monitor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ promu:
build:
${GOBUILD} ${LDFLAG} -o bin/bcs-monitor ./cmd/bcs-monitor

.PHONY: lint
lint:
@golangci-lint run --issues-exit-code=0 --fix

.PHONY: test
test:
@echo ">> test not support"
Expand Down
Loading

0 comments on commit 22e165a

Please sign in to comment.