Open Nuno-Mota opened 1 year ago
Looks like line length computation is still an unknown secret algorithm in 2024 because another tool doesn't get it right - especially it it claims be be a style checker ...
Any plans to get this issue triaged and worked on?
feel free to send a patch instead of snark
I believe I can provide a patch after I reading https://pycodestyle.pycqa.org/en/latest/developer.html#contribute
Let me do some tests on how to solve it efficiently, as it touches every byte.
@asottile I checked on available options to pycodestyle. It misses a tab-size
parameter; only indent-size
is available. Such a parameter is needed to implement the correct calculation if whitespace width.
Are you going to provide such a parameter, or is it up to me to add this with my PR?
(So solving the problem and adding new CLI options.)
--indent-size=n set how many spaces make up an indent (default: 4)
Source: https://pycodestyle.pycqa.org/en/latest/intro.html#configuration
@Paebbels honestly you're attitude or the attitude you convey with your choice of language has biased me against any improvement here since 99% of people writing Python use spaces. If you want traction in this assume you're doing all the work and we'll do our best to review it, assuming you also improve your behavior. If you seem to think another option is necessary at it with a very detailed justification because I don't expect this should require what you are proposing (and thus neither Anthony nor I will be providing that for you)
Hi.
It seems like the
indent-size
option is not considered for the computation of line-length (looking at the code appears to confirm my suspicion). This means that there can be a significant number of false negatives for tab-indented lines.This was tested for
pycodestyle 2.10.0
andpycodestyle 2.11.0
.MWE: All non-ignored test file's lines are longer than the maximum line length, when taking into account the
indent-size
. However, only 2 of them are flagged as such. Each tab counts only 1 space, instead ofindent-size
spaces.tox.ini
Test file
Pycodestyle's output