Skip to content

indent-size not considered when computing length of tab-indented lines. #1189

Description

@Nuno-Mota

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 and pycodestyle 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 of indent-size spaces.

tox.ini

[pycodestyle]
max-line-length = 5
indent-size = 4
show-source = true
ignore=E261, W191

Test file

if True: # noqa: E501
	# aa
	# aaa
	if True: # noqa: E501
		# a
		# aa

Pycodestyle's output

pycodestyle test.py
test.py:3:6: E501 line too long (6 > 5 characters)
	# aaa
	    ^
test.py:6:6: E501 line too long (6 > 5 characters)
		# aa
		   ^
✗ - status code 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions