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

Issue:
Print a message "Nothing to fix"
### Description

Print a message "Nothing to fix" in the absence of `.env` files for fix.

### Implementation

**Step 1:**

Add a method for [FixOutput](https://github.com/dotenv-linter/dotenv-linter/blob/master/src/common/output/fix.rs#L14) to print the message "Nothing to fix" 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#L54) is empty.

**Step 3:**

Add integration tests [here](https://github.com/dotenv-linter/dotenv-linter/blob/master/tests/output/fix.rs).

### Example

There aren't `.env` files in the current directory:

```sh
$ dotenv-linter fix
Nothing to fix
```


Discussion:
I'd like to take this if that's ok :)
I'll assign that issue to you 🙂 



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d330fc35..cfcece879 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Added a Fix Benchmark [#399](https://github.com/dotenv-linter/dotenv-linter/pull/399) ([@a4blue](https://github.com/a4blue))
 - Add benchmark for the compare function
   [#395](https://github.com/dotenv-linter/dotenv-linter/pull/395) ([@FrancisMurillo](https://github.com/FrancisMurillo))
+- Print a message when there are no input files for fix subcommand [#394](https://github.com/dotenv-linter/dotenv-linter/pull/394) ([@mdycz](https://github.com/mdycz))
 - 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/fix.rs b/src/common/output/fix.rs
index 10b664646..3c1afbba2 100644
--- a/src/common/output/fix.rs
+++ b/src/common/output/fix.rs
@@ -54,4 +54,13 @@ impl FixOutput {
             println!();
         }
     }
+
+    /// Prints no files found message
+    pub fn print_nothing_to_fix(&self) {
+        if self.is_quiet_mode || self.files_count > 0 {
+            return;
+        }
+
+        println!("Nothing to fix");
+    }
 }
diff --git a/src/lib.rs b/src/lib.rs
index c68af25ec..ba430a943 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -50,9 +50,11 @@ pub fn check(args: &clap::ArgMatches, current_dir: &PathBuf) -> Result<usize, Bo
 pub fn fix(args: &clap::ArgMatches, current_dir: &PathBuf) -> Result<(), Box<dyn Error>> {
     let mut warnings_count = 0;
     let lines_map = get_lines(args, current_dir);
+    let output = FixOutput::new(args.is_present("quiet"), lines_map.len());
 
     // Nothing to fix
     if lines_map.is_empty() {
+        output.print_nothing_to_fix();
         return Ok(());
     }
 
@@ -61,7 +63,6 @@ pub fn fix(args: &clap::ArgMatches, current_dir: &PathBuf) -> Result<(), Box<dyn
         skip_checks = skip.collect();
     }
 
-    let output = FixOutput::new(args.is_present("quiet"), lines_map.len());
     for (index, (fe, strings)) in lines_map.into_iter().enumerate() {
         output.print_processing_info(&fe);
 


Test patch:
diff --git a/tests/output/fix.rs b/tests/output/fix.rs
index ca87dc8e8..c1ac4d2b4 100644
--- a/tests/output/fix.rs
+++ b/tests/output/fix.rs
@@ -212,3 +212,27 @@ All warnings are fixed. Total: 2
 
     test_dir.close();
 }
+
+#[test]
+fn no_files() {
+    let test_dir = TestDir::new();
+
+    let expected_output = String::from(
+        r#"Nothing to fix
+"#,
+    );
+
+    test_dir.test_command_fix_success(expected_output);
+    test_dir.close()
+}
+
+#[test]
+fn quiet_no_files() {
+    let test_dir = TestDir::new();
+
+    let args = &["--quiet"];
+    let expected_output = String::from("");
+
+    test_dir.test_command_fix_success_with_args(expected_output, args);
+    test_dir.close()
+}