Skip to content

Commit 6215334

Browse files
committed
docs: update pages
1 parent eaf48c8 commit 6215334

File tree

5 files changed

+59
-59
lines changed

5 files changed

+59
-59
lines changed

docs/src/docs/contributing/architecture.mdx

Lines changed: 33 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Architecture
33
---
44

5+
56
import ResponsiveContainer from "components/ResponsiveContainer";
67

78
There are the following `golangci-lint` execution steps:
@@ -94,15 +95,12 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
9495
linter.NewConfig(golinters.NewBodyclose()).
9596
WithSince("v1.18.0").
9697
WithLoadForGoAnalysis().
97-
WithPresets(linter.PresetPerformance, linter.PresetBugs).
9898
WithURL("https://github.com/timakin/bodyclose"),
9999
// ...
100100
linter.NewConfig(golinters.NewGovet(govetCfg)).
101-
WithEnabledByDefault().
101+
WithGroups(config.GroupStandard).
102102
WithSince("v1.0.0").
103103
WithLoadForGoAnalysis().
104-
WithPresets(linter.PresetBugs, linter.PresetMetaLinter).
105-
WithAlternativeNames("vet", "vetshadow").
106104
WithURL("https://pkg.go.dev/cmd/vet"),
107105
// ...
108106
}
@@ -160,72 +158,64 @@ type Issue struct {
160158
// Source lines of a code with the issue to show
161159
SourceLines []string
162160

163-
// If we know how to fix the issue we can provide replacement lines
164-
Replacement *Replacement
165-
166161
// Pkg is needed for proper caching of linting results
167162
Pkg *packages.Package `json:"-"`
168163

169-
LineRange *Range `json:",omitempty"`
170-
171164
Pos token.Position
172165

166+
LineRange *Range `json:",omitempty"`
167+
173168
// HunkPos is used only when golangci-lint is run over a diff
174169
HunkPos int `json:",omitempty"`
175170

171+
// If we know how to fix the issue we can provide replacement lines
172+
SuggestedFixes []analysis.SuggestedFix `json:",omitempty"`
173+
176174
// If we are expecting a nolint (because this is from nolintlint), record the expected linter
177175
ExpectNoLint bool
178176
ExpectedNoLintLinter string
177+
178+
// ...
179179
}
180180
```
181181

182182
## Postprocess Issues
183183

184184
We have an abstraction of `result.Processor` to postprocess found issues:
185185

186-
```sh
186+
<!--
187187
$ tree -L 1 ./pkg/result/processors/
188+
-->
189+
190+
```sh
188191
./pkg/result/processors/
189-
./pkg/result/processors/
190-
├── autogenerated_exclude.go
191-
├── autogenerated_exclude_test.go
192-
├── base_rule.go
193192
├── cgo.go
194193
├── diff.go
195-
├── exclude.go
196-
├── exclude_rules.go
197-
├── exclude_rules_test.go
198-
├── exclude_test.go
194+
├── exclusion_generated_file_filter.go
195+
├── exclusion_generated_file_matcher.go
196+
├── exclusion_paths.go
197+
├── exclusion_presets.go
198+
├── exclusion_rules.go
199199
├── filename_unadjuster.go
200200
├── fixer.go
201201
├── identifier_marker.go
202-
├── identifier_marker_test.go
202+
├── invalid_issue.go
203203
├── issues.go
204204
├── max_from_linter.go
205-
├── max_from_linter_test.go
206205
├── max_per_file_from_linter.go
207-
├── max_per_file_from_linter_test.go
208206
├── max_same_issues.go
209-
├── max_same_issues_test.go
210-
├── nolint.go
211-
├── nolint_test.go
212-
├── path_prefixer.go
213-
├── path_prefixer_test.go
207+
├── nolint_filter.go
208+
├── path_absoluter.go
214209
├── path_prettifier.go
210+
├── path_relativity.go
215211
├── path_shortener.go
216212
├── processor.go
217-
├── processor_test.go
218-
├── severity_rules.go
219-
├── severity_rules_test.go
220-
├── skip_dirs.go
221-
├── skip_files.go
222-
├── skip_files_test.go
213+
├── severity.go
223214
├── sort_results.go
224-
├── sort_results_test.go
225215
├── source_code.go
226-
── testdata
227-
├── uniq_by_line.go
228-
└── uniq_by_line_test.go
216+
── uniq_by_line.go
217+
218+
229219
```
230220

231221
The abstraction is simple:
@@ -238,34 +228,26 @@ type Processor interface {
238228
}
239229
```
240230

241-
A processor can hide issues (`nolint`, `exclude`) or change issues (`path_shortener`).
231+
A processor can hide issues (`nolint`, `exclude`) or change issues (`path_prettifier`).
242232

243233
## Print Issues
244234

245235
We have an abstraction for printing found issues.
246236

247-
```sh
237+
<!--
248238
$ tree -L 1 ./pkg/printers/
239+
-->
240+
241+
```sh
249242
./pkg/printers/
250243
├── checkstyle.go
251-
├── checkstyle_test.go
252244
├── codeclimate.go
253-
├── codeclimate_test.go
254-
├── github.go
255-
├── github_test.go
256245
├── html.go
257-
├── html_test.go
258246
├── json.go
259-
├── json_test.go
260247
├── junitxml.go
261-
├── junitxml_test.go
262248
├── printer.go
249+
├── sarif.go
263250
├── tab.go
264-
├── tab_test.go
265251
├── teamcity.go
266-
├── teamcity_test.go
267-
├── text.go
268-
└── text_test.go
252+
└── text.go
269253
```
270-
271-
Needed printer is selected by command line option `--out-format`.

docs/src/docs/welcome/faq.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ most linters are not able to perform the analysis,
6262
and they simply do not produce any reports,
6363
so it's not possible to skip/ignore `typecheck` errors.
6464

65-
## Why running with `--fast` is slow on the first run?
65+
## Why running with `--fast-only` can be slow on the first run?
6666

67-
Because the first run caches type information. All subsequent runs will be fast.
67+
Because the first run caches type information.
68+
All subsequent runs will be faster.
6869
Usually this options is used during development on local machine and compilation was already performed.
6970

7071
## How do you add a custom linter?

docs/src/docs/welcome/install.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ title: "Install"
77
Most installations of `golangci-lint` are performed for CI.
88

99
It's important to have reproducible CI: don't start to fail all builds at the same time.
10-
With golangci-lint this can happen if you use option `--enable-all` and a new linter is added
11-
or even without `--enable-all` when one upstream linter is upgraded.
10+
With golangci-lint this can happen if you use option `linters.default: all` and a new linter is added
11+
or even without `linters.default: all` when one upstream linter is upgraded.
1212

1313
**IMPORTANT**: It's highly recommended installing a specific version of golangci-lint available on the [releases page](https://github.com/golangci/golangci-lint/releases).
1414

docs/src/docs/welcome/integrations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Recommended settings for VS Code are:
1111
```json
1212
"go.lintTool": "golangci-lint",
1313
"go.lintFlags": [
14-
"--fast"
14+
"--fast-only"
1515
]
1616
```
1717

18-
Using it in an editor without `--fast` can freeze your editor.
18+
Using it in an editor without `--fast-only` can freeze your editor.
1919
Golangci-lint automatically discovers `.golangci.yml` config for edited file: you don't need to configure it in VS Code settings.
2020

2121
### Sublime Text

docs/src/docs/welcome/quick-start.mdx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
title: Quick Start
33
---
44

5-
To run golangci-lint execute:
5+
## Linting
6+
7+
To run golangci-lint:
68

79
```sh
810
golangci-lint run
911
```
1012

11-
It's an equivalent of executing:
13+
It's an equivalent of:
1214

1315
```sh
1416
golangci-lint run ./...
@@ -39,3 +41,18 @@ golangci-lint run --disable-all -E errcheck
3941
```
4042

4143
More information about available linters can be found in the [linters page](/usage/linters/).
44+
45+
## Formatting
46+
47+
To format your code:
48+
49+
```sh
50+
golangci-lint fmt
51+
```
52+
53+
You can choose which directories or files to analyze:
54+
55+
```sh
56+
golangci-lint fmt dir1 dir2/...
57+
golangci-lint fmt file1.go
58+
```

0 commit comments

Comments
 (0)