hayd / pep8radius

PEP8 clean only the parts of the files touched since the last commit, a previous commit or (the merge-base of) a branch.
MIT License
183 stars 9 forks source link

Added a program termination message #11

Closed schodge closed 10 years ago

schodge commented 10 years ago

Added a file counter to indicate how many files were done. Feel free to remove or require verbose.

hayd commented 10 years ago

Thanks for this, is a merge conflict already! (but will add in). I definitely need to reconsider the messages displayed, any thoughts on what would be the ideal ?

hayd commented 10 years ago

How about this:

Applying autopep8 to touched lines in 1 file(s)
1/1: Applying pep8radius to btyfi.py on lines:
     112-93, 91-72, 5-1, 
Pep8radius complete, better than you found it!
schodge commented 10 years ago

That looks good, though the backward ordering of the line groups and lines took me a moment to figure out. (How did I generate a merge conflict? I only added 5 lines...)

My code, of course, took the easy way out and just counted the file list you were supposed to work on; I'm not sure how errors get handled raised in autopep8, if it fails on a file, is there a way for btyfi to know about it?

hayd commented 10 years ago

@schodge I think there's a verbosity setting on autopep8... It's extremely noisy! merge conflict was weird, as it was before I pushed the big change!

hayd commented 10 years ago

@schodge ah cripes you mean like syntax errors... they seem to be ignored i.e. don't raise in autopep8 (but do return the set of remaining infractions which can include sytax errors like bad indentation E113). Great point.

Perhaps the solution here is call autopep8 from the module rather than shell out. That way we can probably print/do something if there are remaining infractions (not looked into this but looks like they are stored as a set of infractions to line numbers)... ?

hayd commented 10 years ago

We call the autopep8 module and pass a load of options to it. We use the verbose settings of autopep8 (one less):

pep8radius -v -v -v

is like calling

autopep8 -v -v

Considering pushing as point release.