Reduce time duration for Pylint sensor - Azure DevOps

I am using Sonar Cloud for a python repository based on Azure DevOps. At this moment the total time for the default “Run Code Analysis” task by Sonar Cloud is quite longer than we expect.

Our repo has about 19k LOC in total and written in Python only. I really expect to find a better way to reduce the time for this task.
Many thanks.

Hi @Le_L_i_Hoang

This is not somewhat a real solution, but given the warning, have you tested to put your PyLint task outside of the scanner and provide path to the report with the given property ?


1 Like

Hello @Le_L_i_Hoang,

With the huge effort we made at SonarSource to provide out of box Python rules that are first class citizens, we would expect you to no longer rely on Pylint at all. Did you consider this option?
See to get the full story:

Until now, we were displaying a warning to invite you to rely on external execution of Pytlint and just load its results into SonarCloud (if you really want it). Soon (actually in 1-2 weeks max), SonarCloud will no longer execute Pylint rules and only SonarCloud Python rules will run.


1 Like

thank @mickaelcaro and @Alexandre_Gigleux for your answers.
I am a little bit confused about whether you are running both Sonar Lint and Pylint or only Sonar Lint only. My project at this moment does not need Pylint because Sonar Lint is good enough for me, so If the total 10-minute duration can be decreased by just stop using Pylint in your background task, it works well for me.


Actually you have the control on the execution of the Pytlint Sensor. If you don’t want it to run, you need to deactivate the rules corresponding to Pylint in the Quality Profile associated to your project in SonarCloud.

Out of the box, only the SonarCloud Rules are executed. This corresponds to the 140 rules of the Python Sonar Way quality profile. Example on my account:

I believe the best for you is to change the configuration of your project to tell SonarCloud to rely only on “Sonar Way”. This can be achieved by clicking on the Administration menu of your project, then Quality Profile. You should see a screen like this:

Here you need to be sure that “Sonar way” is selected for the Python row.


Thank you for your reply @Alexandre_Gigleux
This is the way i set up my quality profile: I normally use the sonarway with some small changes and active some other small rules. I do not set any other pylint run in the project, which make me really thing that should i revert to the built-in option instead of my customize one because my 14 more rules affect a lot to my total time?


I believe indeed it would be better to rely on “Sonar way” and its 140 rules and get rid of your custom profiles where some Pylint rules were activated.

Can you try that and tell me if the execution time is better?

Can you share the list of the 14 rules you activated so that I can check if we have in our plan to implement similar rules in a near future?


Basically I change several rules that suitable our environment. I dont really thing that it make the Sonar Lint run much more longer than the Sonar way only.
About changing rule: We are using Azure Data Bricks at this moment and as our environment requests using some unique name (i.e: getArgument, dbutils), we usually use these names inside our code. However, Sonar Cloud usually show it as an error due to undefined yet (we couldn’t do it) so I usually need to disable the problem for specific names by hand. If there is a way to ignore a list of predifined words, it will solve our problem completely
Many thanks.