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

Issue:
UnorderedKey: Show check name in message
Right now the message looks like this:
```
.env:2 The FOO-BAR key should go before the FOO-BAR key
```

Need to add the check name to the message:
```
.env:2 UnorderedKey: The FOO-BAR key should go before the FOO-BAR key
```


Discussion:
New to rust myself! Mind if I take this up?
@pmk21 Sure! Thank you!



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d6da2f7b..658bd1244 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### 🚀 Added
 
 ### 🔧 Changed
+- UnorderedKey: Added check name to the message [#140](https://github.com/mgrachev/dotenv-linter/pull/140) ([@pmk21](https://github.com/pmk21))
 - Add test coverage for CLI --exclude arguments [#135](https://github.com/mgrachev/dotenv-linter/pull/135) ([@sonro](https://github.com/sonro))
 - Renamed check SpacesAroundEqual to SpaceCharacter [#134](https://github.com/mgrachev/dotenv-linter/pull/134) ([@SaMuRa1ReM1X](https://github.com/SaMuRa1ReM1X))
 - Rename check DuplicatedKeys to DuplicatedKey [#133](https://github.com/mgrachev/dotenv-linter/pull/133) ([@sonro](https://github.com/sonro))
diff --git a/src/checks/unordered_keys.rs b/src/checks/unordered_keys.rs
index 043ef21a3..aa5481218 100644
--- a/src/checks/unordered_keys.rs
+++ b/src/checks/unordered_keys.rs
@@ -4,12 +4,26 @@ use crate::common::*;
 pub(crate) struct UnorderedKeysChecker {
     template: String,
     keys: Vec<String>,
+    name: String,
+}
+
+impl UnorderedKeysChecker {
+    fn message(&self, key_one: &str, key_two: &str) -> String {
+        return format!(
+            "{}: {}",
+            self.name,
+            self.template
+                .replace("{1}", key_one)
+                .replace("{2}", key_two)
+        );
+    }
 }
 
 impl Default for UnorderedKeysChecker {
     fn default() -> Self {
         Self {
             keys: Vec::new(),
+            name: String::from("UnorderedKey"),
             template: String::from("The {1} key should go before the {2} key"),
         }
     }
@@ -27,12 +41,7 @@ impl Check for UnorderedKeysChecker {
 
             let another_key = sorted_keys.get(index + 1)?;
 
-            let warning = Warning::new(
-                line.clone(),
-                self.template
-                    .replace("{1}", &key)
-                    .replace("{2}", &another_key),
-            );
+            let warning = Warning::new(line.clone(), self.message(&key, &another_key));
             return Some(warning);
         }
 
@@ -115,7 +124,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("BAR=FOO"),
                     },
-                    String::from("The BAR key should go before the FOO key"),
+                    String::from("UnorderedKey: The BAR key should go before the FOO key"),
                 )),
             ),
         ];
@@ -146,7 +155,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("BAR=FOO"),
                     },
-                    String::from("The BAR key should go before the FOO key"),
+                    String::from("UnorderedKey: The BAR key should go before the FOO key"),
                 )),
             ),
             (
@@ -161,7 +170,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("ABC=BAR"),
                     },
-                    String::from("The ABC key should go before the BAR key"),
+                    String::from("UnorderedKey: The ABC key should go before the BAR key"),
                 )),
             ),
         ];
@@ -192,7 +201,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("BAR=FOO"),
                     },
-                    String::from("The BAR key should go before the FOO key"),
+                    String::from("UnorderedKey: The BAR key should go before the FOO key"),
                 )),
             ),
             (
@@ -207,7 +216,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("DDD=BAR"),
                     },
-                    String::from("The DDD key should go before the FOO key"),
+                    String::from("UnorderedKey: The DDD key should go before the FOO key"),
                 )),
             ),
         ];
@@ -238,7 +247,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("BAR=FOO"),
                     },
-                    String::from("The BAR key should go before the FOO key"),
+                    String::from("UnorderedKey: The BAR key should go before the FOO key"),
                 )),
             ),
             (
@@ -253,7 +262,7 @@ mod tests {
                         file_path: PathBuf::from(".env"),
                         raw_string: String::from("DDD=BAR"),
                     },
-                    String::from("The DDD key should go before the FOO key"),
+                    String::from("UnorderedKey: The DDD key should go before the FOO key"),
                 )),
             ),
             (


Test patch:
diff --git a/tests/cli_test.rs b/tests/cli_test.rs
index 5ca9f4908..223a63f97 100644
--- a/tests/cli_test.rs
+++ b/tests/cli_test.rs
@@ -215,7 +215,7 @@ fn checks_one_specific_file_and_one_path() {
         .failure()
         .code(1)
         .stdout(format!(
-            "{}/{}:2 The FOO key is duplicated\n{}:2 The BAR key should go before the FOO key\n",
+            "{}/{}:2 The FOO key is duplicated\n{}:2 UnorderedKey: The BAR key should go before the FOO key\n",
             relative_path.to_str().unwrap(),
             file_path3.file_name().unwrap().to_str().unwrap(),
             file_path2.file_name().unwrap().to_str().unwrap(),