Skip to content

Commit 41fcbf6

Browse files
committed
docs: explain limitations of the usage of the methods
1 parent bf0d1a5 commit 41fcbf6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: revgrep.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ type Checker struct {
4444
}
4545

4646
// Prepare extracts a patch and changed lines.
47-
// It should only be used with [Checker.IsNewIssue].
47+
//
48+
// WARNING: it should only be used before an explicit call to [Checker.IsNewIssue].
49+
//
50+
// WARNING: only [Checker.Patch], [Checker.RevisionFrom], [Checker.RevisionTo], [Checker.WholeFiles] options are used,
51+
// the other options ([Checker.Regexp], [Checker.AbsPath]) are only used by [Checker.Check].
4852
func (c *Checker) Prepare(ctx context.Context) error {
4953
err := c.loadPatch(ctx)
5054

@@ -54,7 +58,8 @@ func (c *Checker) Prepare(ctx context.Context) error {
5458
}
5559

5660
// IsNewIssue checks whether issue found by linter is new: it was found in changed lines.
57-
// It requires to call [Checker.Prepare] before call this method to load the changes from patch.
61+
//
62+
// WARNING: it requires to call [Checker.Prepare] before call this method to load the changes from patch.
5863
func (c *Checker) IsNewIssue(i InputIssue) (hunkPos int, isNew bool) {
5964
changes, ok := c.changes[filepath.ToSlash(i.FilePath())]
6065
if !ok {

0 commit comments

Comments
 (0)