chore: enable more linters (#241)
Signed-off-by: knqyf263 <knqyf263@gmail.com> Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
This commit is contained in:
parent
09c1d4dd53
commit
6e704239a6
15
.github/workflows/go.yml
vendored
15
.github/workflows/go.yml
vendored
@ -6,22 +6,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.18
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v3.7.0
|
||||
with:
|
||||
version: v1.45
|
||||
version: v1.54
|
||||
args : --verbose
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
go test -v ./...
|
||||
make test
|
||||
|
||||
|
@ -4,11 +4,35 @@ run:
|
||||
linters:
|
||||
enable:
|
||||
- gofmt
|
||||
disable:
|
||||
- errcheck
|
||||
- bodyclose
|
||||
- staticcheck
|
||||
- unused
|
||||
- gci
|
||||
- gomodguard
|
||||
- tenv
|
||||
- gosimple
|
||||
- govet
|
||||
disable:
|
||||
- errcheck
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- unused
|
||||
linters-settings:
|
||||
gci:
|
||||
sections:
|
||||
- standard
|
||||
- default
|
||||
- prefix(github.com/aquasecurity/)
|
||||
- blank
|
||||
- dot
|
||||
gomodguard:
|
||||
blocked:
|
||||
modules:
|
||||
- github.com/hashicorp/go-version:
|
||||
recommendations:
|
||||
- github.com/aquasecurity/go-version
|
||||
reason: "`aquasecurity/go-version` is degisned for our use-cases"
|
||||
- github.com/Masterminds/semver:
|
||||
recommendations:
|
||||
- github.com/aquasecurity/go-version
|
||||
reason: "`aquasecurity/go-version` is degisned for our use-cases"
|
||||
|
||||
|
23
Makefile
Normal file
23
Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
export SHELL := /bin/bash
|
||||
export SHELLOPTS := errexit
|
||||
|
||||
GOPATH ?= $(shell go env GOPATH)
|
||||
BIN_DIR := $(GOPATH)/bin
|
||||
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint
|
||||
|
||||
.PHONY: lint lintfix test build
|
||||
|
||||
$(GOLANGCI_LINT):
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BIN_DIR) v1.54.2
|
||||
|
||||
lint: $(GOLANGCI_LINT)
|
||||
@$(GOLANGCI_LINT) run
|
||||
|
||||
lintfix: $(GOLANGCI_LINT)
|
||||
@$(GOLANGCI_LINT) run --fix
|
||||
|
||||
test:
|
||||
go test -race ./...
|
||||
|
||||
build:
|
||||
go build -o vuln-list-update .
|
@ -10,9 +10,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -8,10 +8,11 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/alma"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/alma"
|
||||
)
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
|
@ -6,14 +6,16 @@ import (
|
||||
"compress/gzip"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/cheggaaa/pb.v1"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/cheggaaa/pb.v1"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -10,10 +10,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/amazon"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestConfig_Update(t *testing.T) {
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1,7 +1,6 @@
|
||||
package arch_test
|
||||
|
||||
import (
|
||||
"github.com/aquasecurity/vuln-list-update/arch"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@ -11,6 +10,8 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/arch"
|
||||
)
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
|
@ -9,10 +9,11 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/chainguard"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/chainguard"
|
||||
)
|
||||
|
||||
var update = flag.Bool("update", false, "update golden files")
|
||||
|
@ -11,8 +11,9 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
type CWEConfig struct {
|
||||
|
@ -9,9 +9,8 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
|
@ -10,12 +10,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/cheggaaa/pb"
|
||||
githubql "github.com/shurcooL/githubv4"
|
||||
"github.com/shurcooL/graphql"
|
||||
"github.com/spf13/afero"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
// https://developer.github.com/v4/enum/securityadvisoryecosystem/
|
||||
|
@ -7,8 +7,9 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
type Operations interface {
|
||||
|
@ -2,11 +2,13 @@ package kevc
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/cheggaaa/pb"
|
||||
"golang.org/x/xerrors"
|
||||
"log"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cheggaaa/pb"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1,14 +1,16 @@
|
||||
package kevc_test
|
||||
|
||||
import (
|
||||
"github.com/aquasecurity/vuln-list-update/kevc"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/kevc"
|
||||
)
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
|
@ -11,10 +11,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
jsonpointer "github.com/mattn/go-jsonpointer"
|
||||
"golang.org/x/xerrors"
|
||||
pb "gopkg.in/cheggaaa/pb.v1"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
type NVD struct {
|
||||
|
@ -9,10 +9,11 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/spf13/afero"
|
||||
"golang.org/x/xerrors"
|
||||
pb "gopkg.in/cheggaaa/pb.v1"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/oracle/oval"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/aquasecurity/vuln-list-update/oracle/oval"
|
||||
)
|
||||
|
||||
var update = flag.Bool("update", false, "update golden files")
|
||||
|
@ -5,10 +5,11 @@ import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/oracle/oval"
|
||||
"github.com/kylelemons/godebug/pretty"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/oracle/oval"
|
||||
)
|
||||
|
||||
func TestRedhatCVEJSON_UnmarshalJSON(t *testing.T) {
|
||||
|
@ -8,9 +8,10 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/osv"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/osv"
|
||||
)
|
||||
|
||||
func Test_Update(t *testing.T) {
|
||||
|
@ -7,10 +7,11 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/cheggaaa/pb"
|
||||
"github.com/spf13/afero"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -10,10 +10,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
var update = flag.Bool("update", false, "update golden files")
|
||||
|
@ -6,8 +6,9 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/redhat/securitydataapi"
|
||||
"github.com/kylelemons/godebug/pretty"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/redhat/securitydataapi"
|
||||
)
|
||||
|
||||
func TestRedhatCVEJSON_UnmarshalJSON(t *testing.T) {
|
||||
|
@ -15,9 +15,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -7,9 +7,10 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/rocky"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/rocky"
|
||||
)
|
||||
|
||||
func Test_Update(t *testing.T) {
|
||||
|
@ -11,10 +11,11 @@ import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
"github.com/cheggaaa/pb"
|
||||
"github.com/spf13/afero"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -8,11 +8,10 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/suse/cvrf"
|
||||
)
|
||||
|
||||
|
@ -9,12 +9,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/git"
|
||||
|
||||
"github.com/araddon/dateparse"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/git"
|
||||
"github.com/aquasecurity/vuln-list-update/utils"
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -9,10 +9,11 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/wolfi"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/aquasecurity/vuln-list-update/wolfi"
|
||||
)
|
||||
|
||||
var update = flag.Bool("update", false, "update golden files")
|
||||
|
Loading…
Reference in New Issue
Block a user