Closed beeftornado closed 10 years ago
Does the first line with leading space contain 12 spaces?
I did a little digging and found the cause to be an extended conditional clause that was broken up to multiple lines and occurs before any indented code blocks.
# ... comments and imports ...
if hasattr(cfg,
'debug') and cfg.debug:
############ (12)
# ... rest of code with functions and things ...
I can fix this by just unindenting the continuation, but many coders' style is to line up the continuation with the clauses before it.
I'll have to make this a little more intelligent by searching all lines for leading spaces and using the smallest length of leading spaces. I think I was a bit naive to think scanning the whole file wasn't necessary.
Heh, it surprisingly works in most cases though.
You might be able to build off this logic http://stackoverflow.com/a/7113875/276125
Let me know if it works for you. Added a test based on your sample code, so you should be good to go.
Thanks, looks good.
I have a python file that when I open, the tab size is detected to be a width of 12 and it should be 4.