Skip to content

Commit

Permalink
silence empty stdin (#210)
Browse files Browse the repository at this point in the history
If stdin is provided, but empty, don't write anything about stdin in the report.
  • Loading branch information
cdignam-segment authored May 11, 2022
1 parent c731fc6 commit afffabf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## v0.11.2 - 2022-05-11

## Fixed

- silence stdin if it's empty (#210)

## v0.11.1 - 2022-05-11

## Fixed
Expand Down
9 changes: 7 additions & 2 deletions cli/src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,13 @@ pub fn check_files(
if is_stdin {
info!("reading content from stdin");
let sql = get_sql_from_stdin()?;
let path = stdin_path.unwrap_or_else(|| "stdin".into());
process_violations(&sql, &path)?;
// ignore stdin if it's empty.
if sql.trim().is_empty() {
let path = stdin_path.unwrap_or_else(|| "stdin".into());
process_violations(&sql, &path)?;
} else {
info!("ignoring empty stdin");
}
}

for path in paths {
Expand Down

0 comments on commit afffabf

Please sign in to comment.