Using Pep8 for Python

Hi, i am a new user of Sonar Cloud and i want to ask how to setting these feature.
My company askes me to set up the Python quality for code that suitable with Pep 8 quality (https://www.python.org/dev/peps/pep-0008/). However, when i search for “pep” in Python rules, i can not find it. So my question is that do you have already set up this feature, or how can i expand the basical rule in order to catch up with our requirement
Thank in advance

Hi @Le_L_i_Hoang,

There is currently no automatic way to enable pep8-related rules. Some of these rules will be available by default. You can search for rules marked with the “convention” tag.

Additional styling issues can be imported from Pylint. You will have to activate them both in your pylintrc configuration file and in your Quality Profile. Pylint rules can be filtered by selecting “Repository”->“Pylint”. Note that pylint does more than detecting pep8 issues, thus you will have to select the rules you want to activate.

Also don’t forget to enable your new quality profile for your projects.

We plan to make Pylint issues import easier so these instructions will change in the future.

Cheers,

1 Like

I want to ask question about my sonar.properties file: What should i add to configuration in order to active pylint?
Right now we run it? Thanks in advance

Hi @Le_L_i_Hoang,

You have to run pylint and import the report during the analysis. The exact command and configuration property are available in the documentation.

Cheers,

1 Like