New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpaceConsistencyBear only catches spaces that match indent_size when use_spaces = False #6132
Comments
Hi, can I work on this issue? |
@Heisenberg403 Sure, feel free to work on the issue. Do have a look if there's a PR already created or for this issue so that the efforts are not duplicated :) |
I did some digging and the code responsible for this is: coala/coalib/bearlib/spacing/SpacingHelper.py Lines 77 to 120 in 7d4247b
The main reason this happens is because SpaceConsistencyBear does not calculate indentation sizing on the fly. Not specifying @abhishalya I've not thought this through but will modifying/creating a function to detect indentation on the fly work? All we need is the leading whitespace for a line and it's predecessor's. The current EDIT: |
Overview Description
Hello!
I have a Python project that is written using tabs. Without setting
indent_size
, I would expect that files written with 2 spaces or 4 spaces for indentation would be caught bySpaceConsistencyBear
, but only files with 4 spaces are caught.Steps To Reproduce
.coafile
like this:my_file.py
file like this (notice only 2 space for indent):$ coala
, receive no suggested patches.my_file.py
like this (with 4 spaces for indent):$ coala
, receive suggested patches.indent_size = 2
to the.coafile
:$ coala
on both versions ofmy_file.py
- both are caught.Actual Results
SpaceConsistencyBear only catches spaces that match indent_size when
use_spaces = False
Expected Results
SpaceConsistencyBear catches all files indented with spaces when
use_spaces = False
Reproducibility
Every time.
Additional Information:
Hope this helps :)
The text was updated successfully, but these errors were encountered: