Closed raxod502 closed 5 years ago
Apparently, the proper way to do that is
(setq lsp-clients-python-settings '(:plugins (:mccabe (:threshold 17 :enabled t))))
And the default configuration is wrong... Are you interested in helping to fix that?
(cc @cslux)
Here it is a link to the lsp-java https://github.com/emacs-lsp/lsp-java/blob/master/lsp-java.el#L231 . We probably need to define a macro which simplifies that job, something like:
(lsp-defcustom pyls.plugins.jedi_completion.enabled server-id default-value "description" [type])
@yyoncho I can give it a shot!
I did not notice it the last time, because I customized mccab, etc.. through setup.cfg and tox.ini.
@cslux sure, go ahead.
I am going to implement - https://github.com/emacs-lsp/lsp-mode/issues/715#issuecomment-473503166 . Apparently, in order to make our life easier, we should have a similar to vscodes mechanism for defining extension properties.
Describe the bug Changing settings in
lsp-clients-python-settings
does not affect the operation ofmccabe
.To Reproduce Open any Python file which has a function whose cyclomatic complexity is greater than 15. Here is an example:
Click to expand code
```python def complex_function(): if True: if True: if True: if True: pass else: pass else: if True: pass else: pass else: if True: if True: pass else: pass else: if True: pass else: pass else: if True: if True: if True: pass else: pass else: if True: pass else: pass else: if True: if True: pass else: pass else: if True: pass else: pass ```
Set up
lsp-mode
withpyls
and enablelsp-ui
with Flycheck.Expected behavior No error should be reported as
:plugins.mccabe.enabled
is set tonil
inlsp-clients-python-settings
.Actual behavior I see an error
mccabe: Cyclomatic complexity too high: 16 (threshold 15)
in the sideline fromlsp-ui-sideline
. Furthermore, if I change:plugins.mccabe.threshold
inlsp-clients-python-settings
from its default of 15 to, say, 50 and then runM-x lsp-restart-workspace
, I see no difference at all—the threshold is still reported as 15. Clearly, the configuration inlsp-clients-python-settings
is not being respected by the LSP server.Which Language Server did you use
lsp-python
OS macOS 10.14.3
Logging