nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: dotenv-linter/dotenv-linter
Pull request #656 (2023-04-03 09:10:12)

refactor(cli): move `cli/mod.rs` to `cli.rs`
Uses cli.rs instead of cli/mod.rs in order to be consistent with other root level modules under the dotenv-linter crate

<!--
Thank you for your pull request. Please provide a description above and review
the requirements below.

Bug fixes and new features should include tests.
-->

<!-- _Please make sure to review and check all of these items:_ -->

#### ✔ Checklist:

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] Commit messages have been written in [Conventional Commits](https://www.conventionalcommits.org) format;
- [ ] Tests for the changes have been added (for bug fixes / features);
- [ ] Docs have been added / updated on the [dotenv-linter.github.io](https://github.com/dotenv-linter/dotenv-linter.github.io) (for bug fixes / features).

<!-- _NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open._ -->



Patch:
diff --git a/dotenv-linter/src/cli/mod.rs b/dotenv-linter/src/cli.rs
similarity index 100%
rename from dotenv-linter/src/cli/mod.rs
rename to dotenv-linter/src/cli.rs
diff --git a/dotenv-linter/src/common/output/compare.rs b/dotenv-linter/src/common/output/compare.rs
index 0a6218c..03717d7 100644
--- a/dotenv-linter/src/common/output/compare.rs
+++ b/dotenv-linter/src/common/output/compare.rs
@@ -29,4 +29,11 @@ pub fn print_nothing_to_compare(&self) {
             println!("Nothing to compare");
         }
     }
+
+    /// Prints "No difference found" when the two compared files have no difference
+    pub fn print_no_difference_found(&self) {
+        if !self.is_quiet_mode {
+            println!("No difference found");
+        }
+    }
 }
diff --git a/dotenv-linter/src/lib.rs b/dotenv-linter/src/lib.rs
index 0ff1709..ef8f39e 100644
--- a/dotenv-linter/src/lib.rs
+++ b/dotenv-linter/src/lib.rs
@@ -143,6 +143,12 @@ pub fn compare(opts: &CompareOptions, current_dir: &PathBuf) -> Result<usize> {
         }
     }
 
+    // Create success message if no warnings found.
+    if warnings.is_empty() {
+        output.print_no_difference_found();
+        return Ok(0);
+    }
+
     output.print_warnings(&warnings);
     Ok(warnings.len())
 }


Test patch:
diff --git a/dotenv-linter/tests/compare/compare.rs b/dotenv-linter/tests/compare/compare.rs
index e16dcae..acb62d7 100644
--- a/dotenv-linter/tests/compare/compare.rs
+++ b/dotenv-linter/tests/compare/compare.rs
@@ -5,7 +5,7 @@ fn files_with_same_environment_variables() {
     let test_dir = TestDir::new();
     let testfile_one = test_dir.create_testfile(".env1", "FOO=abc\nBAR=def");
     let testfile_two = test_dir.create_testfile(".env2", "FOO=abc\nBAR=def");
-    let expected_output = "Comparing .env1\nComparing .env2\n";
+    let expected_output = "Comparing .env1\nComparing .env2\nNo difference found\n";
 
     test_dir.test_command_success_with_args(
         &["compare", testfile_one.as_str(), testfile_two.as_str()],