Repository: dotenv-linter/dotenv-linter (Rust)

Issue:
Print a message "Nothing to check"
### Description

Print a message "Nothing to check" in the absence of `.env` files for check.

### Implementation

**Step 1:**

Add a method for [CheckOutput](https://github.com/dotenv-linter/dotenv-linter/blob/master/src/common/output/check.rs#L11) to print the message "Nothing to check" only if `is_quiet_mode == false`.

**Step 2:**

Call the method from the step 1 when [lines_map](https://github.com/dotenv-linter/dotenv-linter/blob/master/src/lib.rs#L20) is empty.

**Step 3:**

Add integration tests [here](https://github.com/dotenv-linter/dotenv-linter/blob/master/tests/output/check.rs).

### Example

There aren't `.env` files in the current directory:

```sh
$ dotenv-linter
Nothing to check
```


Discussion:
I will look at this in the evening, if it's okay! :)
Sure, I assign you to that issue.



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba53dca9b..8f33535e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### 🚀 Added
+- Print a message when there are no input files [#392](https://github.com/dotenv-linter/dotenv-linter/pull/392) ([@jodli](https://github.com/jodli))
 - Add a GitHub Action to compare benchmarks [#378](https://github.com/dotenv-linter/dotenv-linter/pull/378) ([@mgrachev](https://github.com/mgrachev))
 - Add benchmark for the check function [#376](https://github.com/dotenv-linter/dotenv-linter/pull/376) ([@mgrachev](https://github.com/mgrachev))
 
diff --git a/src/common/output/check.rs b/src/common/output/check.rs
index ca2207062..eee3e8305 100644
--- a/src/common/output/check.rs
+++ b/src/common/output/check.rs
@@ -16,6 +16,13 @@ impl CheckOutput {
         }
     }
 
+    /// Prints a message that there is nothing to check
+    pub fn print_nothing_to_check(&self) {
+        if !self.is_quiet_mode {
+            println!("Nothing to check");
+        }
+    }
+
     /// Prints information about a file in process
     pub fn print_processing_info(&self, file: &FileEntry) {
         if !self.is_quiet_mode {
diff --git a/src/lib.rs b/src/lib.rs
index cff80a2fe..c68af25ec 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,9 +16,10 @@ use std::rc::Rc;
 
 pub fn check(args: &clap::ArgMatches, current_dir: &PathBuf) -> Result<usize, Box<dyn Error>> {
     let lines_map = get_lines(args, current_dir);
+    let output = CheckOutput::new(args.is_present("quiet"), lines_map.len());
 
-    // Nothing to check
     if lines_map.is_empty() {
+        output.print_nothing_to_check();
         return Ok(0);
     }
 
@@ -27,7 +28,6 @@ pub fn check(args: &clap::ArgMatches, current_dir: &PathBuf) -> Result<usize, Bo
         skip_checks = skip.collect();
     }
 
-    let output = CheckOutput::new(args.is_present("quiet"), lines_map.len());
     let warnings_count =
         lines_map
             .into_iter()


Test patch:
diff --git a/tests/options/exclude.rs b/tests/options/exclude.rs
index dc783f64d..0307bd727 100644
--- a/tests/options/exclude.rs
+++ b/tests/options/exclude.rs
@@ -5,7 +5,10 @@ fn exclude_one_file() {
     let test_dir = TestDir::new();
     let testfile = test_dir.create_testfile(".env", " FOO=\n");
 
-    let expected_output = check_output(&[]);
+    let expected_output = String::from(
+        r#"Nothing to check
+"#,
+    );
 
     test_dir.test_command_success_with_args(&["--exclude", testfile.as_str()], expected_output);
 }
@@ -16,7 +19,10 @@ fn exclude_two_files() {
     let testfile_1 = test_dir.create_testfile(".env", " FOO=\n");
     let testfile_2 = test_dir.create_testfile(".local.env", " BAR=\n");
 
-    let expected_output = check_output(&[]);
+    let expected_output = String::from(
+        r#"Nothing to check
+"#,
+    );
 
     test_dir.test_command_success_with_args(
         &["-e", testfile_1.as_str(), "-e", testfile_2.as_str()],
diff --git a/tests/output/check.rs b/tests/output/check.rs
index 528593656..74045d1e0 100644
--- a/tests/output/check.rs
+++ b/tests/output/check.rs
@@ -107,6 +107,18 @@ No problems found
     test_dir.test_command_success(expected_output);
 }
 
+#[test]
+fn no_files() {
+    let test_dir = TestDir::new();
+
+    let expected_output = String::from(
+        r#"Nothing to check
+"#,
+    );
+
+    test_dir.test_command_success(expected_output);
+}
+
 #[test]
 fn quiet() {
     let test_dir = TestDir::new();
@@ -130,3 +142,13 @@ fn quiet_no_problems() {
 
     test_dir.test_command_success_with_args(args, expected_output);
 }
+
+#[test]
+fn quiet_no_files() {
+    let test_dir = TestDir::new();
+
+    let args = &["--quiet"];
+    let expected_output = String::from("");
+
+    test_dir.test_command_success_with_args(args, expected_output);
+}