Esc

detached_doc_comment

Finds a comment that reads as a declaration's docs but has a blank line between it and the declaration.

Category pedantic, allow by default.

Off by default; the example is shown with the rule enabled.

Example
#import "Basic";

// Adds one to the number it is given.

bump :: (n: int) -> int {
    return n + 1;
}

main :: () {
    print("%\n", bump(1));
}
Diagnostic
warning[detached_doc_comment]: this comment is separated from `bump` by a blank line, so it is not its doc comment
  --> example.jai:3:1
   |
 3 | // Adds one to the number it is given.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: remove the blank line to document it
   |
 4 - 
   |
Fixed
#import "Basic";

// Adds one to the number it is given.
bump :: (n: int) -> int {
    return n + 1;
}

main :: () {
    print("%\n", bump(1));
}

A top-level procedure, struct or enum with a blank line between its declaration and a comment above that reads as a sentence (three or more words.