Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mfederowicz committed Nov 1, 2023
1 parent bc03b7a commit 4f6f50d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func assertFailures(t *testing.T, baseDir string, fi os.FileInfo, src []byte, ru
}

if in.Match == p.Failure {
// check replacement if we are expecting one
// check replacement if we are expecting one
if in.Replacement != "" {
// ignore any inline comments, since that would be recursive
r := p.ReplacementLine
Expand All @@ -111,8 +111,8 @@ func assertFailures(t *testing.T, baseDir string, fi os.FileInfo, src []byte, ru
}

}
// remove this problem from ps

// remove this problem from ps
copy(failures[i:], failures[i+1:])
failures = failures[:len(failures)-1]

Expand All @@ -132,14 +132,15 @@ func assertFailures(t *testing.T, baseDir string, fi os.FileInfo, src []byte, ru
}

type instruction struct {
Line int // the line number this applies to
Match string // which pattern to match
Replacement string // what the suggested replacement line should be
RuleName string
Category string
Confidence float64
Line int // the line number this applies to
Match string // which pattern to match
Replacement string // what the suggested replacement line should be
RuleName string // what rule we use
Category string // which category
Confidence float64 // confidence level
}

// structure used when we parse json object insted of classic MATCH string

Check warning on line 143 in test/utils.go

View workflow job for this annotation

GitHub Actions / Lint

comment on exported type JsonInstruction should be of the form "JsonInstruction ..." (with optional leading article)
type JsonInstruction struct {

Check warning on line 144 in test/utils.go

View workflow job for this annotation

GitHub Actions / Lint

type JsonInstruction should be JSONInstruction
Match string `json:"MATCH"`
Category string `json:"Category"`
Expand Down Expand Up @@ -226,7 +227,7 @@ func extractInstructionFromJson(line string, lineNumber int) (instruction, error

func extractDataMode(line string) string {

if strings.HasPrefix(line, "json") {
if strings.HasPrefix(line, "json") {
return "json"
}
if strings.Contains(line, "MATCH") {
Expand Down

0 comments on commit 4f6f50d

Please sign in to comment.