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

Issue:
SpaceCharacter: Show check name in message
Right now the message looks like this:
```
.env:2 The line has spaces around equal sign
```

Need to add the check name to the message:
```
.env:2 SpaceCharacter: The line has spaces around equal sign
```


Discussion:
I'll take this!

@Am3ra 👋Is there any progress with this issue?
I'll take it
@pineapplethief Thank you! I've assigned you!



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 204c626d6..d2596e327 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
+- SpaceCharacter: Show check name in the message [#149](https://github.com/mgrachev/dotenv-linter/pull/149) ([@pineapplethief](https://github.com/pineapplethief))
 - LeadingCharacter: Show check name in message [#144](https://github.com/mgrachev/dotenv-linter/pull/144) ([@michaetto](https://github.com/michaetto))
 - Rename `UnorderedKeys` check to singular `UnorderedKey` [#147](https://github.com/mgrachev/dotenv-linter/pull/147) ([@pineapplethief](https://github.com/pineapplethief))
 - KeyWithoutValue: Show check name in the message [#139](https://github.com/mgrachev/dotenv-linter/pull/139) ([@harshu4](https://github.com/harshu4))
diff --git a/README.md b/README.md
index ef24cba8a..d6b54e155 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
 
 ```shell script
 # Linux
-$ curl https://github.com/mgrachev/dotenv-linter/releases/download/v1.1.2/dotenv-linter-linux-x86_64.tar.gz -sSfL | tar -xzf - 
+$ curl https://github.com/mgrachev/dotenv-linter/releases/download/v1.1.2/dotenv-linter-linux-x86_64.tar.gz -sSfL | tar -xzf -
 
 # Alpine Linux
 $ wget https://github.com/mgrachev/dotenv-linter/releases/download/v1.1.2/dotenv-linter-alpine-x86_64.tar.gz -O - -q | tar -xzf -
@@ -42,7 +42,7 @@ $ docker run --rm -v `pwd`:/app -w /app mgrachev/dotenv-linter
 
 ### Cargo
 
-If you are a **Rust** programmer, you can install `dotenv-linter` via `cargo`: 
+If you are a **Rust** programmer, you can install `dotenv-linter` via `cargo`:
 
 ```shell script
 $ cargo install dotenv-linter
@@ -104,7 +104,7 @@ $ dotenv-linter
 .env:1 Invalid leading character detected
 .env:2 The FOO-BAR key has incorrect delimiter
 .env:3 The FOo_BAR key should be in uppercase
-.env:4 The line has spaces around equal sign
+.env:4 SpaceCharacter:The line has spaces around equal sign
 test.env:5 The foo_bar key should be in uppercase
 test.env:6 The FOO key should be with a value or have an equal sign
 ```
@@ -116,7 +116,7 @@ you can use the argument `--include FILE_NAME` or its short version `-i FILE_NAM
 $ dotenv-linter -i test.dotenv .my-env-file
 .env:1 Invalid leading character detected
 test.dotenv:2 The FOO-BAR key has incorrect delimiter
-.my-env-file:3 The line has spaces around equal sign
+.my-env-file:3 SpaceCharacter: The line has spaces around equal sign
 ```
 
 If you want to exclude a file with a specific name from check,
diff --git a/src/checks/space_character.rs b/src/checks/space_character.rs
index 6fb5b02a6..124d8c7d8 100644
--- a/src/checks/space_character.rs
+++ b/src/checks/space_character.rs
@@ -3,11 +3,19 @@ use crate::common::*;
 
 pub(crate) struct SpaceCharacterChecker {
     template: String,
+    name: String,
+}
+
+impl SpaceCharacterChecker {
+    fn message(&self) -> String {
+        return format!("{}: {}", self.name, self.template);
+    }
 }
 
 impl Default for SpaceCharacterChecker {
     fn default() -> Self {
         Self {
+            name: String::from("SpaceCharacter"),
             template: String::from("The line has spaces around equal sign"),
         }
     }
@@ -19,7 +27,8 @@ impl Check for SpaceCharacterChecker {
 
         if let [key, value] = &line_splitted[..] {
             if key.ends_with(' ') || value.starts_with(' ') {
-                return Some(Warning::new(line.clone(), self.template.clone()));
+                let warning = Warning::new(line.clone(), self.message());
+                return Some(warning);
             }
         }
 
@@ -32,7 +41,7 @@ mod tests {
     use super::*;
     use std::path::PathBuf;
 
-    const MESSAGE: &str = "The line has spaces around equal sign";
+    const MESSAGE: &str = "SpaceCharacter: The line has spaces around equal sign";
 
     #[test]
     fn working_run() {


Test patch:
diff --git a/tests/cli_specific.rs b/tests/cli_specific.rs
index b987314b9..407c3db32 100644
--- a/tests/cli_specific.rs
+++ b/tests/cli_specific.rs
@@ -52,7 +52,7 @@ fn checks_one_specific_file() {
 
     let args = &[testfile_2.as_str()];
     let expected_output = format!(
-        "{}:1 The line has spaces around equal sign\n",
+        "{}:1 SpaceCharacter: The line has spaces around equal sign\n",
         testfile_2.shortname_as_str()
     );
 
@@ -70,7 +70,7 @@ fn checks_two_specific_files() {
 
     let args = &[testfile_2.as_str(), testfile_3.as_str()];
     let expected_output = format!(
-        "{}/{}:2 DuplicatedKey: The FOO key is duplicated\n{}:1 The line has spaces around equal sign\n",
+        "{}/{}:2 DuplicatedKey: The FOO key is duplicated\n{}:1 SpaceCharacter: The line has spaces around equal sign\n",
         testdir.relative_path(&subdir),
         testfile_3.shortname_as_str(),
         testfile_2.shortname_as_str(),