mirror of
				https://github.com/mgechev/revive.git
				synced 2025-10-30 23:37:49 +02:00 
			
		
		
		
	chore: enable formatters in golangci-lint config (#1421)
This commit is contained in:
		
							
								
								
									
										13
									
								
								.github/workflows/lint.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/lint.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -19,19 +19,6 @@ jobs: | ||||
|           git diff --exit-code go.mod | ||||
|           git diff --exit-code go.sum | ||||
|  | ||||
|   gofmt: | ||||
|     name: Check unformatted Go code | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - uses: actions/setup-go@v5 | ||||
|         with: | ||||
|           go-version: stable | ||||
|       - name: Run gofmt | ||||
|         run: | | ||||
|           find . -type f -name '*.go' -not -path './testdata/*' -exec gofmt -w {} + | ||||
|           git diff --exit-code | ||||
|  | ||||
|   lint-go: | ||||
|     name: Lint Go | ||||
|     runs-on: ubuntu-latest | ||||
|   | ||||
| @@ -90,6 +90,18 @@ linters: | ||||
|         - name: var-declaration | ||||
|         - name: var-naming | ||||
|  | ||||
| formatters: | ||||
|   enable: | ||||
|     - gci | ||||
|     - gofmt | ||||
|     - goimports | ||||
|   settings: | ||||
|     gci: | ||||
|       sections: | ||||
|         - standard | ||||
|         - default | ||||
|         - prefix(github.com/mgechev/revive) | ||||
|  | ||||
| issues: | ||||
|   # Show all issues from a linter. | ||||
|   max-issues-per-linter: 0 | ||||
|   | ||||
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							| @@ -18,7 +18,10 @@ build: | ||||
|  | ||||
| lint: | ||||
| 	revive --config revive.toml ./... | ||||
| 	golangci-lint run | ||||
|  | ||||
| fmt: | ||||
| 	golangci-lint fmt | ||||
|  | ||||
| test: | ||||
| 	@go test -v -race ./... | ||||
|  | ||||
|   | ||||
| @@ -10,9 +10,10 @@ import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/fatih/color" | ||||
| 	"github.com/spf13/afero" | ||||
|  | ||||
| 	"github.com/mgechev/revive/config" | ||||
| 	"github.com/mgechev/revive/revivelib" | ||||
| 	"github.com/spf13/afero" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
|   | ||||
| @@ -10,6 +10,7 @@ import ( | ||||
| 	"text/tabwriter" | ||||
|  | ||||
| 	"github.com/fatih/color" | ||||
|  | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"codeberg.org/chavacava/garif" | ||||
|  | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/fatih/color" | ||||
|  | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -10,6 +10,7 @@ import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/mgechev/dots" | ||||
|  | ||||
| 	"github.com/mgechev/revive/config" | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| 	"github.com/mgechev/revive/logging" | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/fatih/color" | ||||
|  | ||||
| 	"github.com/mgechev/revive/config" | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| 	"github.com/mgechev/revive/revivelib" | ||||
|   | ||||
| @@ -5,8 +5,9 @@ import ( | ||||
| 	"go/ast" | ||||
| 	"go/token" | ||||
|  | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| 	"golang.org/x/tools/go/ast/astutil" | ||||
|  | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| ) | ||||
|  | ||||
| // CognitiveComplexityRule sets restriction for maximum cognitive complexity. | ||||
|   | ||||
| @@ -8,6 +8,7 @@ import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/fatih/structtag" | ||||
|  | ||||
| 	"github.com/mgechev/revive/internal/astutils" | ||||
| 	"github.com/mgechev/revive/lint" | ||||
| ) | ||||
|   | ||||
| @@ -1,8 +1,9 @@ | ||||
| package test | ||||
|  | ||||
| import ( | ||||
| 	"github.com/mgechev/revive/rule" | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/mgechev/revive/rule" | ||||
| ) | ||||
|  | ||||
| func TestRedundantImportAlias(t *testing.T) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user