Skip to content
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

Expect lines to be indented 8 places when tabs are used #837

Merged
merged 1 commit into from
Feb 1, 2019
Merged

Expect lines to be indented 8 places when tabs are used #837

merged 1 commit into from
Feb 1, 2019

Conversation

jdufresne
Copy link
Contributor

Fixes #836

@sciyoshi Are you able to test if this fixes the issue you reported?

@@ -125,15 +125,15 @@ def test_styleguide(self):
report = pycodestyle.StyleGuide().check_files([E11])
stdout = sys.stdout.getvalue().splitlines()
self.assertEqual(len(stdout), report.total_errors)
self.assertEqual(report.total_errors, 20)
self.assertEqual(report.total_errors, 24)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new errors are:

pycodestyle/testsuite/E11.py:41:1: E302 expected 2 blank lines, found 0
pycodestyle/testsuite/E11.py:42:1: E101 indentation contains mixed spaces and tabs
pycodestyle/testsuite/E11.py:42:1: W191 indentation contains tabs
pycodestyle/testsuite/E11.py:42:3: E117 over-indented

@sigmavirus24 sigmavirus24 merged commit e71908e into PyCQA:master Feb 1, 2019
@GPHemsley
Copy link

PEP8 says:

Use 4 spaces per indentation level.

If a tab is used as indentation (my preference), it should be assumed to have a tabwidth of 4 by default.

If other codebases are using other tabwidths (8 and 2 are probably the most common alternatives), then it might make more sense to add a config option to allow customizing tabwidth rather than having the default divert that far from PEP8.

(Note also the existence of flake8-tabs.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E117 being reported for files containing tabs
4 participants