Repository: sscpac/statick

Issue:
docformatter doesn't catch issues with files
I think there's two issues:
1. docformatter returns `3` when a file needs to be formatted, this is not 0 so statick thinks it's a CalledProcessError and says that the [binary failed](https://github.com/sscpac/statick/blob/master/statick_tool/plugins/tool/docformatter_tool_plugin.py#L45). I think this should only happen if the return code is not `3`
2. ~~The regex used for parsing lines doesn't seem to correctly grab the filename: https://github.com/sscpac/statick/blob/master/statick_tool/plugins/tool/docformatter_tool_plugin.py#L67
example docformatter output: `[FILE_ABSOLUTE_PATH]`~~ I was wrong about this, the regex is parsing the line just fine.

Discussion:
codecov-io: # [Codecov](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=h1) Report
> Merging [#334](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=desc) (9b7afc3) into [master](https://codecov.io/gh/sscpac/statick/commit/1ac53c41f187594573a49a1c179d5ce69ce34fe4?el=desc) (1ac53c4) will **decrease** coverage by `4.87%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/sscpac/statick/pull/334/graphs/tree.svg?width=650&height=150&src=pr&token=Vgq0OM4Uhi)](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##            master     #334      +/-   ##
===========================================
- Coverage   100.00%   95.12%   -4.88%     
===========================================
  Files           51       51              
  Lines         2894     2895       +1     
===========================================
- Hits          2894     2754     -140     
- Misses           0      141     +141     
```


| [Impacted Files](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...tick\_tool/plugins/tool/docformatter\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9kb2Nmb3JtYXR0ZXJfdG9vbF9wbHVnaW4ucHk=) | `100.00% <100.00%> (ø)` | |
| [...tatick\_tool/plugins/tool/shellcheck\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9zaGVsbGNoZWNrX3Rvb2xfcGx1Z2luLnB5) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
| [...tatick\_tool/plugins/tool/uncrustify\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC91bmNydXN0aWZ5X3Rvb2xfcGx1Z2luLnB5) | `66.66% <0.00%> (-33.34%)` | :arrow_down: |
| [statick\_tool/plugins/tool/cppcheck\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9jcHBjaGVja190b29sX3BsdWdpbi5weQ==) | `85.10% <0.00%> (-14.90%)` | :arrow_down: |
| [...tatick\_tool/plugins/tool/perlcritic\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9wZXJsY3JpdGljX3Rvb2xfcGx1Z2luLnB5) | `87.03% <0.00%> (-12.97%)` | :arrow_down: |
| [...tatick\_tool/plugins/tool/clang\_tidy\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9jbGFuZ190aWR5X3Rvb2xfcGx1Z2luLnB5) | `87.32% <0.00%> (-12.68%)` | :arrow_down: |
| [...tick\_tool/plugins/tool/clang\_format\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9jbGFuZ19mb3JtYXRfdG9vbF9wbHVnaW4ucHk=) | `90.26% <0.00%> (-9.74%)` | :arrow_down: |
| [statick\_tool/plugins/tool/cpplint\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9jcHBsaW50X3Rvb2xfcGx1Z2luLnB5) | `90.32% <0.00%> (-9.68%)` | :arrow_down: |
| [...tatick\_tool/plugins/tool/flawfinder\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9mbGF3ZmluZGVyX3Rvb2xfcGx1Z2luLnB5) | `91.11% <0.00%> (-8.89%)` | :arrow_down: |
| [statick\_tool/plugins/tool/spotbugs\_tool\_plugin.py](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree#diff-c3RhdGlja190b29sL3BsdWdpbnMvdG9vbC9zcG90YnVnc190b29sX3BsdWdpbi5weQ==) | `91.56% <0.00%> (-8.44%)` | :arrow_down: |
| ... and [6 more](https://codecov.io/gh/sscpac/statick/pull/334/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=footer). Last update [1ac53c4...9b7afc3](https://codecov.io/gh/sscpac/statick/pull/334?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/statick_tool/plugins/tool/docformatter_tool_plugin.py b/statick_tool/plugins/tool/docformatter_tool_plugin.py
index ef33fde..9e0a04e 100644
--- a/statick_tool/plugins/tool/docformatter_tool_plugin.py
+++ b/statick_tool/plugins/tool/docformatter_tool_plugin.py
@@ -42,11 +42,13 @@ class DocformatterToolPlugin(ToolPlugin):
                 return []
 
             except subprocess.CalledProcessError as ex:
-                logging.warning("docformatter binary failed: %s.", tool_bin)
-                logging.warning("Returncode: %d", ex.returncode)
-                logging.warning("%s exception: %s", self.get_name(), ex.output)
-                total_output.append(ex.output)
-                continue
+                if ex.returncode == 3:
+                    total_output.append(ex.output)
+                else:
+                    logging.warning("docformatter binary failed: %s.", tool_bin)
+                    logging.warning("Returncode: %d", ex.returncode)
+                    logging.warning("%s exception: %s", self.get_name(), ex.output)
+                    continue
 
         for output in total_output:
             logging.debug("%s", output)
@@ -80,7 +82,7 @@ class DocformatterToolPlugin(ToolPlugin):
                             self.get_name(),
                             "format",
                             "3",
-                            "docformatter",
+                            "would reformat",
                             None,
                         )
                     )


Test patch:
diff --git a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py
index 738a8af..7584f27 100644
--- a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py
+++ b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py
@@ -95,7 +95,7 @@ def test_docformatter_tool_plugin_parse_valid():
     assert issues[0].tool == "docformatter"
     assert issues[0].issue_type == "format"
     assert issues[0].severity == "3"
-    assert issues[0].message == "docformatter"
+    assert issues[0].message == "would reformat"
 
 
 def test_docformatter_tool_plugin_parse_invalid():