For multiple developers using VS or QtCreator to edit C++ files we used (1) beautifier plugin to run clang-format in ui (e.g. upon saving a file) and (2) git hooks to run the beautifier before commit just in case someone edits a file without IDE. Both, formatting in IDE and in git-hooks have to produce exactly the same results.
What is the easiest way to get the same effect for python file if we used PyCharm as IDE?
(1) there are no beautifier plugins, right? if we use PyCharm for editing, we have to use PyCharm formatter (we cannot run e.g. yapf automatically from ui instead)? right? Or is there any way to replace PyCharm formatter by another beautifier?
If there is no choice in ui, then we are forced to use "pycharm.bat format" from command line for git hooks. For this, we would use style settings per project, and in "pycharm.bat format -f xxx" we can provide project's .idea\codeStyles\Project.xml. BUT if I run it just like that, I have to close PyCharm first before committing anything :( This is, obviously, not acceptable.
(2) git hooks need to run pycharm.bat while the code is still open in IDE. https://intellij-support.jetbrains.com/hc/en-us/community/posts/205799739-How-to-start-another-instance-of-PyCharm- seems to suggest that we could:
* unpack a second copy of PyCharm (we cannot use installer, right?)
* modify idea.properties in bin folder (we need to change both idea.config.path and idea.system.path, right? anything else?)
* make sure that start menu has a shortcut to the first copy, while PATH contains a path to the second copy
This seems irritatingly silly. Still: would it work? :) Is there any other/better way?