require-blank-line-after-multiline-statement
WarningWarningWarningWarningLeave a blank line after a multi-line statement, such as a control-flow block, an if or loop without braces, a method chain or a multi-line literal.
fn run(value: u8) -> u8 { if value > 10 { return 10; } let doubled = value * 2; return doubled;}fn run(value: Option<u8>) -> u8 { let Some(value) = value else { return 0; }; return value;}fn run(connection: &PgPool) -> Result<User> { let user = User::find_by_id(connection, &id) .await? .ok_or_else(|| ApplicationError::NotFound("User"))?; return Ok(user);}fn run(value: Option<u8>) -> u8 { let Some(value) = value else { return 0; }; if value > 10 { return 10; } return value;}fn status(result: Result<(), Error>) -> u16 { return match result { Ok(()) => 204, Err(Error::NotFound) => { log(); 404 } Err(_) => 500, };}fn run(connection: &PgPool) -> Result<User> { let user = User::find_by_id(connection, &id) .await? .ok_or_else(|| ApplicationError::NotFound("User"))?; return Ok(user);}function run(value: number) { for (const item of items) { process(item); } return value;}function run() { register({ name: "core", }); register({ name: "theme", });}function parse(output: string) { const parsed: unknown = JSON.parse(output); if (!Array.isArray(parsed)) throw new Error("Unexpected output"); return parsed;}function run(items: Item[]) { for (const item of items) process(item); save();}function run(value: number) { if (value > 10) { return 10; } return value;}function run() { const names = users .map((user) => user.name) .join(", "); return names;}function parse(output: string) { let diagnostics: Diagnostic[]; try { const parsed: unknown = JSON.parse(output); if (!Array.isArray(parsed)) throw new Error("Unexpected output"); diagnostics = parsed as Diagnostic[]; } catch { return; }}int run(int value) { if (value > 10) { return 10; } final doubled = value * 2; return doubled;}void run() { final result = client.query( QueryOptions(document: document), ); setData(result);}int run(int value) { if (value > 10) { return 10; } return value;}void run() { final result = client.query( QueryOptions(document: document), ); print(result);}class A { void run() { if (ready) { process(); } save(); }}class A { void run() { client.fetch() .thenApply(this::map) .join(); save(); }}class A { void run() { if (ready) { process(); } save(); }}class A { void run() { client.fetch() .thenApply(this::map) .join(); save(); }}How to fix
A multi-line if, loop, match, let-else, literal or method chain ends a group of statements.
The check reads the enclosing block's text because the syntax tree omits blank lines. If the block is missing more than one blank line, the report can land on a neighboring statement.
How to fix
A multi-line if, loop, switch, try, literal or method chain ends a group of statements. An if or loop without braces counts if its body is on the next line.
The check reads the enclosing block's text because the syntax tree omits blank lines. If the block is missing more than one blank line, the report can land on a neighboring statement.
How to fix
A multi-line if, loop, switch, try, literal or method chain ends a group of statements.
The check reads the enclosing block's text because the syntax tree omits blank lines. If the block is missing more than one blank line, the report can land on a neighboring statement.
How to fix
A multi-line if, loop, switch, try, literal or method chain ends a group of statements.
The check reads the enclosing block's text because the syntax tree omits blank lines. If the block is missing more than one blank line, the report can land on a neighboring statement.