Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate pylint with github review comments

I am trying to make a script that runs pylint on the files present in the pull request and creates inline comments for the linting errors.

I got a hang on how to use PyGithub. The problem is that in order to comment on a pull-request you will have to know the commit that modified the file and the line number from the patch. Full documentation on the review comments API is found here.

Pylint returns the line in the resulted file. I need to get from foo/bar.py:30 to the commit that modified line 30 in foo/bar.py and to get the actual position in the diff for that file.

Is there something that already can do this or do I have to manually search for @@ lines in every commit involved in a pull request?

like image 768
mbivol Avatar asked Nov 11 '22 16:11

mbivol


1 Answers

What you are asking for is exactly what the blame feature does.

The only API I could find was this restfulgit.

Based on blind text search this here looks like the function that implements getting blame info, if you understand how it uses the underlying git api then you can just copy that part instead of using the restfulgit

like image 135
Kashyap Avatar answered Nov 14 '22 21:11

Kashyap