Skip to content

Commit 29f1516

Browse files
pohlyldez
andauthored
Apply suggestions from code review
Co-authored-by: Ludovic Fernandez <[email protected]>
1 parent 3107130 commit 29f1516

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

docs/src/docs/usage/false-positives.mdx

+3-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ issues:
6666

6767
Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options.
6868

69-
Beware that the paths that get matched here are relative to the current working
70-
directory. When the configuration contains path patterns that check for specific
71-
directories, the `--path-prefix` parameter can be used to extend the paths
72-
before matching.
69+
Beware that the paths that get matched here are relative to the current working directory.
70+
When the configuration contains path patterns that check for specific directories,
71+
the `--path-prefix` parameter can be used to extend the paths before matching.
7372

7473
In the following example, all the reports from the linters (`linters`) that concerns the path (`path`) are excluded:
7574

pkg/fsutils/files.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package fsutils
22

33
import "path/filepath"
44

5-
// Files combines different operations related to handling file paths and
6-
// content.
5+
// Files combines different operations related to handling file paths and content.
76
type Files struct {
87
*LineCache
98
pathPrefix string
@@ -16,18 +15,16 @@ func NewFiles(lc *LineCache, pathPrefix string) *Files {
1615
}
1716
}
1817

19-
// WithPathPrefix takes a path that is relative to the current directory (as
20-
// used in in issues) and adds the configured path prefix, if there is one. The
21-
// resulting path then can be shown to the user or compared against paths
22-
// specified in the configuration.
18+
// WithPathPrefix takes a path that is relative to the current directory (as used in issues)
19+
// and adds the configured path prefix, if there is one.
20+
// The resulting path then can be shown to the user or compared against paths specified in the configuration.
2321
func (f *Files) WithPathPrefix(relativePath string) string {
2422
return WithPathPrefix(f.pathPrefix, relativePath)
2523
}
2624

27-
// WithPathPrefix takes a path that is relative to the current directory (as
28-
// used in in issues) and adds the configured path prefix, if there is one. The
29-
// resulting path then can be shown to the user or compared against paths
30-
// specified in the configuration.
25+
// WithPathPrefix takes a path that is relative to the current directory (as used in issues)
26+
// and adds the configured path prefix, if there is one.
27+
// The resulting path then can be shown to the user or compared against paths specified in the configuration.
3128
func WithPathPrefix(pathPrefix, relativePath string) string {
3229
if pathPrefix == "" {
3330
return relativePath

pkg/lint/runner.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ type Runner struct {
2929

3030
func NewRunner(cfg *config.Config, log logutils.Log, goenv *goutil.Env, es *lintersdb.EnabledSet,
3131
lineCache *fsutils.LineCache, dbManager *lintersdb.Manager, pkgs []*gopackages.Package) (*Runner, error) {
32-
// Beware that some processors need to add the path prefix when working
33-
// with paths because they get invoked before the path prefixer
34-
// (exclude and severity rules) or process other paths (skip files).
32+
// Beware that some processors need to add the path prefix when working with paths
33+
// because they get invoked before the path prefixer (exclude and severity rules)
34+
// or process other paths (skip files).
3535
files := fsutils.NewFiles(lineCache, cfg.Output.PathPrefix)
3636

3737
skipFilesProcessor, err := processors.NewSkipFiles(cfg.Run.SkipFiles, cfg.Output.PathPrefix)

0 commit comments

Comments
 (0)