Qt World Summit: Submit your Presentation


Disable specific Python warnings



  • (QTCreator 4.13.3)

    I have a project with python files full of warnings such as:
    070c1ab2-4d35-48c7-b84b-ed1e55eec80b-image.png
    -E501 line too long
    -E303 too many blank lines
    etc.

    Is there a way to deactivate specific error messages.
    In C++ we can configure the Clang code model options to do this, maybe there is something similar for python in the UI or some configuration file somewhere?



  • @silenthell
    Sadly I do not see any way to do this. Qt Creator editing of Python is still very much a second- (third-)class citizen, despite The Qt Company's claims of making it first-class over the years :( I will watch this thread for any better answer.

    You could/might ask this in the Python section of Qt bug reports, or request it as a feature, I don't know whether you'll get a useful response.

    FWIW, when I did Qt Python I was using PyQt5 (PySide2 too lacking on supported features), and I chose the excellent PyCharm editor/debugger for my IDE. I can quite understand why you would want to use Qt Creator now for an integrated experience, but I think it's sorely lacking in comparison....



  • @JonB I see maybe it'll get better in the future. Yes PyCharm works very well but I'm often developing projects that mix C++ and Python so as you said an integrated experience would be awesome.



  • The linting is performed by pylsp, documentation for this can be found here:
    https://github.com/python-lsp/python-lsp-server

    There is not a great deal of configuration for this in QtCreator however if you create:
    ~/.config/pycodestyle

    You can add something like this to ignore specific rules:

    [pycodestyle]
    ignore = E226, E722, W504, E501
    

    Also if you are interested in what pylsp is doing you can modify its command line to generate logs:
    pylsp


Log in to reply