Pylint rules in Python Sonar Plugin are not synced with Pylint

877 views
Skip to first unread message

xti...@gmail.com

unread,
Aug 10, 2017, 3:59:37 PM8/10/17
to SonarQube
Pylint currently has 221 rules (pylint --list-msgs), but the repository of rules called Pylint only contains 180.

If I try import the rules from Pylint, 41 rules are ignored.

Why are ignored? where is the log of this import operation? How my environment is going to be homogenized if the lint tool is not synced with the metrics portal?

G. Ann Campbell

unread,
Aug 10, 2017, 4:21:26 PM8/10/17
to SonarQube, xti...@gmail.com
Hi,

First, please be aware that the standard courtesies (Hi, Thanks, ...) are appreciated in this group.

Second, SonarQube is not a "metrics portal", but a code quality management platform. We've made a concerted effort in the last few years to from the former to the latter, so hopefully you can see why that would be a sensitive point.

Regarding your problem, it's not clear to me what you mean when you say "import the rules". Are you trying to create a custom Python Quality Profile using Pylint rules? If so, your missing rules are likely missing because, as far as I can tell SonarPython supports (includes the rules from) Pylint 1.2.1. If you try to create a Quality Profile by importing a file that specifies the use of unrecognized rules, then they're simply going to be ignored. 

Why don't you get a log of a Quality Profile import? Because what you're doing isn't actually a supported use case. The supported use case is that you export an existing Quality Profile to file for some reason, and then reimport it later. In such a case, there shouldn't be any unrecognized rules.

But anyway, feel free to submit a pull request adding the missing rules.


Ann

xti...@gmail.com

unread,
Aug 10, 2017, 4:33:59 PM8/10/17
to SonarQube, xti...@gmail.com
Hello Ann, 

First I apologize for my lack of courtesy, Some moderators from Stackoverflow remove all signs of courtesy from the questions posted there, therefore I get used to create them with out any hint of personal interaction.

second, what i mean with "import the rules" is that I used a modified version of the sonar-rule-extractor tool to extract the rules of the last version of Pylint, then I modified the resulting XML in order to import a quality profile with all the rules from Pylint.

Thanks for your time and your quick answer.

Cristian 

G. Ann Campbell

unread,
Aug 11, 2017, 7:57:48 AM8/11/17
to xti...@gmail.com, SonarQube
Hi Cristian,

That's not a supported use case and you've just complained about the "why". :-)

Specifically, I can write the XML to put rule "foo" in a profile, but if the underlying analyzer doesn't know what "foo" is, then it's not going to do me any good.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/EyEMZKVWn2c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/58c25109-4a83-48b6-b0a7-76977fb1fc17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages