myint / pyformat

Formats Python code to follow a consistent style
https://pypi.python.org/pypi/pyformat
96 stars 10 forks source link

show diff only when --diff #10

Open misho104 opened 5 years ago

misho104 commented 5 years ago

The current behavior of pyformat is different from autopep8, which returns diff only when --diff option is specified and otherwise returns the whole file content. It would be nice if the behavior of pyformat, which currently returns diff always, could be the same as autopep8, because then users can use pyformat just by replacing their autopep8 to pyformat.

For example, this issue of vscode is solved and vscode users can use pyformat with a simple modification of their configuration.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 5d21b07a8cc3f1a74b5973f2769b1599e1fd4c4a on misho104:diff_option into 7293e4dd46433b56bb9224ce0a19f616a231c0ed on myint:master.

myint commented 5 years ago

Thanks! To preserve backward compatibility, let's make an option to print out the whole file. Leave the current behavior as the default. Note that the diff-by-default behavior matches some other other tools (autoflake, unify, etc.).

Also, I don't think it should allow printing out the whole file if there are multiple files being checked. This would risk someone accidentally concatenating multiple files into a single file.

misho104 commented 5 years ago

Fair enough, and i agree on it! I'll try to do such when I have spare time.