You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcNewTestApp(t*testing.T, so, se*bytes.Buffer) *App {
// once we've set the mock we're done in this// test process -- even for other unit testskeyring.MockInit()
. . .
produces cmd/test_common.go:15: block should not start with a whitespace
I believe a small change to the logic should fix this. Also, the option isn't documented as the other config options.
// If we have multiple groups, add support for newline between each group.
if p.config.AllowSeparatedLeadingComment {
- if seenCommentGroups > 1 {- allowedLinesBeforeFirstStatement += seenCommentGroups - 1+ if seenCommentGroups > 0 {+ allowedLinesBeforeFirstStatement += seenCommentGroups
}
}
The text was updated successfully, but these errors were encountered:
I kinda think this example is correct, it should yield an error. To me, with the option to allow multiple groups I would think this would be the correct way:
Should yield error
BLOCK {
// Single comment newlineSTMT
}
BLOCK {
// Multi statmeent// Newline but still whitesapceSTMT
}
BLOCK {
// Single leadingSTMT
}
BLOCK {
// Double leading// With whitespaceSTMT
}
Should not yield error
BLOCK {
// Single no leadingSTMT
}
BLOCK {
// Double no leading// whitespace after BLOCK or before STMTSTMT
}
With your suggested change, we sould only support a single comment group without whitespace after BLOCK or before STMT like any of these.
BLOCK {
// Single no leadingSTMT
}
BLOCK {
// Single no leading// Still same block// Just multiple linesSTMT
}
The fix I gave works for the example shown above, but doesn't work for the cases in the UT TestWithConfig/allow_separated_leading_comment
The problem is with "add support for newline between each group" where I think it needs to allow
a newline after each group, or perhaps (better), just not allow a newline before the first group.
With this option enabled,
produces
cmd/test_common.go:15: block should not start with a whitespace
I believe a small change to the logic should fix this. Also, the option isn't documented as the other config options.
The text was updated successfully, but these errors were encountered: