mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
fix(fmt): return None
if sql fmt result is the same (#27014)
Similar with https://github.com/denoland/deno/pull/25848, we need to make `format_sql` to return `None` so we do not flag well formatted sql files as being wrong. Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com>
This commit is contained in:
parent
5462b5828d
commit
9eee2a0e9e
2 changed files with 11 additions and 3 deletions
|
@ -549,7 +549,11 @@ pub fn format_sql(
|
||||||
// Add single new line to the end of file.
|
// Add single new line to the end of file.
|
||||||
formatted_str.push('\n');
|
formatted_str.push('\n');
|
||||||
|
|
||||||
Ok(Some(formatted_str))
|
Ok(if formatted_str == file_text {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(formatted_str)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Formats a single TS, TSX, JS, JSX, JSONC, JSON, MD, IPYNB or SQL file.
|
/// Formats a single TS, TSX, JS, JSX, JSONC, JSON, MD, IPYNB or SQL file.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
},
|
},
|
||||||
"flag": {
|
"flag": {
|
||||||
"args": "fmt --unstable-sql",
|
"args": "fmt --unstable-sql",
|
||||||
"output": "[UNORDERED_START]\n[WILDLINE]badly_formatted.sql\n[WILDLINE]well_formatted.sql\n[WILDLINE]wrong_file_ignore.sql\n[UNORDERED_END]\nChecked 7 files\n"
|
"output": "[UNORDERED_START]\n[WILDLINE]badly_formatted.sql\n[WILDLINE]wrong_file_ignore.sql\n[UNORDERED_END]\nChecked 7 files\n"
|
||||||
},
|
},
|
||||||
"config_file": {
|
"config_file": {
|
||||||
"steps": [{
|
"steps": [{
|
||||||
|
@ -18,8 +18,12 @@
|
||||||
"output": "[WILDCARD]"
|
"output": "[WILDCARD]"
|
||||||
}, {
|
}, {
|
||||||
"args": "fmt",
|
"args": "fmt",
|
||||||
"output": "[UNORDERED_START]\n[WILDLINE]badly_formatted.sql\n[WILDLINE]well_formatted.sql\n[WILDLINE]wrong_file_ignore.sql\n[UNORDERED_END]\nChecked 8 files\n"
|
"output": "[UNORDERED_START]\n[WILDLINE]badly_formatted.sql\n[WILDLINE]wrong_file_ignore.sql\n[UNORDERED_END]\nChecked 8 files\n"
|
||||||
}]
|
}]
|
||||||
|
},
|
||||||
|
"well_formatted_check": {
|
||||||
|
"args": "fmt --unstable-sql --check well_formatted.sql",
|
||||||
|
"output": "Checked 1 file\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue