Based on Perl, I used Cc to hit to format my code according to the predefined rules of Perl::Tidy . Now, with Python, I am surprised to learn that there is nothing remotely resembling the power of Perl::Tidy . PythonTidy 1.20 looks almost appropriate, but at the first level it is erroneously aligned ("unexpected indentation").
In particular, I am looking for the following:
- Put PEP-8 to use as much as possible (the following elements are essentially conclusions of this)
- Convert indent tabs to spaces
- Remove trailing spaces
- Break the code according to the predefined line length as much as possible (chaining method of line splitting and splitting Eclipse styles)
- Normalize spaces around
- (bonus function, optional) Re-formatting code, including indentation.
Right now, I am pep8 through someone else's code and fixing all pep8 and pyflakes tell me that basically โremoves the trailing spaceโ and โinserts an extra blank lineโ. Although I know that re-indentation is not trivial in Python (although it should be possible just by going through the code and remembering the indentation), the other functions seem quite easy, and I cannot believe that no one has implemented this before.
Any recommendations?
Refresh . I'm going to take a deeper look at PythonTidy as it seems to be going in the right direction. Maybe I can find out why it hurts me.
source share