简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM