updated formatting options

This commit is contained in:
Lynne Megido 2021-11-06 02:43:08 +10:00
parent 28aa3ad783
commit 44e14fbfba
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
2 changed files with 13 additions and 6 deletions

View file

@ -199,10 +199,19 @@ number will be updated as follows:
when adding the ability to exclude extensions, and when fif gained the ability to output a bash script rather than a
list of invalid filenames). The MINOR version will also be bumped when increasing the MSRV.
- The PATCH version will be bumped in all other cases, including minor feature additions (in the past, this has occurred
when adding features such as more output formats and the ignore flag).
when adding features such as more output formats and the "ignore unknown extensions" flag).
If/when fif hits version 1.0, these rules will likely remain the same as they are now.
## Code style
fif is formatted with `rustfmt` using a nightly toolchain, specifically with the command `cargo +nightly fmt`. Tabs are
used for indentation, and are assumed to be two spaces wide. Lines are 120 characters wide. Braces are placed on the
same line (["OTBS"](https://en.wikipedia.org/wiki/Indentation_style#Variant:_1TBS_(OTBS)) format), except in the case of
`where` clauses in generic parameters.
For more detailed information on the formatting rules used by this project, see the configured options in
[`rustfmt.toml`](https://gitlab.com/Lynnesbian/fif/-/blob/master/rustfmt.toml).
## License
Copyright (C) 2021 Lynnesbian

View file

@ -215,20 +215,18 @@ fn main() {
} else {
let mut buffered_stdout = BufWriter::new(stdout());
let result = match args.output_format {
if match args.output_format {
// TODO: simplify this to something like formats::write_all(args.output_format, ...)
OutputFormat::Sh => formats::Shell.write_all(&mut buffered_stdout, &findings, &errors),
OutputFormat::PowerShell => formats::PowerShell.write_all(&mut buffered_stdout, &findings, &errors),
#[cfg(feature = "json")]
OutputFormat::Json => formats::Json.write_all(&mut buffered_stdout, &findings, &errors),
OutputFormat::Text => formats::Text.write_all(&mut buffered_stdout, &findings, &errors),
};
if result.is_err() {
}.is_err() {
error!("Failed to write to stdout.");
exit(exitcode::IOERR);
}
if buffered_stdout.flush().is_err() {
error!("Failed to flush stdout.");
exit(exitcode::IOERR);