Repository: palantir/python-language-server (python)

Issue:
It would be better to keep output from the flake8 linter to be consistent with that of pycodestyle.
Currently, the return message the flake8 linter [here](https://github.com/palantir/python-language-server/blob/develop/pyls/plugins/flake8_lint.py) does not contain the error code, while that of pycodestyle also include the error code.

It would be better to include the error code as well, something like the following:

> E303 too many blank lines (2)

It is a fairly simple fix.  Should I open a pull request for this?


Pull request description:
Add code in front of the diagnostic message for flake8
For the issue discussed in https://github.com/palantir/python-language-server/issues/884, it would be better to also add the code in front the actual diagnostic message, to make the message style the same as pycodestyle.

Fixes #884.

Patch:
diff --git a/pyls/plugins/flake8_lint.py b/pyls/plugins/flake8_lint.py
index 1a65851..4f2e054 100644
--- a/pyls/plugins/flake8_lint.py
+++ b/pyls/plugins/flake8_lint.py
@@ -144,6 +144,8 @@ def parse_stdout(document, stdout):
         _, line, character, code, msg = parsed_line
         line = int(line) - 1
         character = int(character) - 1
+        # show also the code in message
+        msg = code + ' ' + msg
         diagnostics.append(
             {
                 'source': 'flake8',


Test patch:
diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py
index acc770b..75adf4e 100644
--- a/test/plugins/test_flake8_lint.py
+++ b/test/plugins/test_flake8_lint.py
@@ -31,7 +31,7 @@ def temp_document(doc_text, workspace):
 def test_flake8_unsaved(workspace):
     doc = Document('', workspace, DOC)
     diags = flake8_lint.pyls_lint(workspace, doc)
-    msg = 'local variable \'a\' is assigned to but never used'
+    msg = 'F841 local variable \'a\' is assigned to but never used'
     unused_var = [d for d in diags if d['message'] == msg][0]
 
     assert unused_var['source'] == 'flake8'
@@ -45,7 +45,7 @@ def test_flake8_lint(workspace):
     try:
         name, doc = temp_document(DOC, workspace)
         diags = flake8_lint.pyls_lint(workspace, doc)
-        msg = 'local variable \'a\' is assigned to but never used'
+        msg = 'F841 local variable \'a\' is assigned to but never used'
         unused_var = [d for d in diags if d['message'] == msg][0]
 
         assert unused_var['source'] == 'flake8'