Skip to content

Commit

Permalink
Add a conditional for blank line insertion-2
Browse files Browse the repository at this point in the history
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
  • Loading branch information
ashutosh-narkar committed Feb 23, 2024
1 parent 685c88a commit ba2448a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion format/format.go
Expand Up @@ -394,7 +394,7 @@ func (w *writer) writeRules(rules []*ast.Rule, o fmtOpts, comments []*ast.Commen

// add a blank line to separate annotations from trailing comments to avoid errors during
// annotation parsing which expects a blank line between them
if len(comments) > 0 {
if len(rule.Annotations) > 0 && len(comments) > 0 {
w.blankLine()
}
}
Expand Down

0 comments on commit ba2448a

Please sign in to comment.