I didn’t find an answer to this question on the web, so I’ll say it up front; this is NOT a question about SublimeLinter, and I do NOT want to format my python code according to the PEP8 standards.
How to disable the warning “Indentation contains tabs” in the Python Checker package?
asked Apr 30, 2014 at 8:52
7
You can use set sublime as:
view -> Indentation -> Convert indentation to spaces
This will enable your tabs to be converted to 4(according your setting) spaces. It works on my machine.
And modify the existing tabs in the file to spaces:
View -> Indentation -> Convert Indentation to Spaces
ndmeiri
4,95912 gold badges35 silver badges44 bronze badges
answered Dec 23, 2014 at 2:31
SolomonSolomon
931 silver badge1 bronze badge
2
in sublime 2
select Prefences > Package setting > Python Fake8 Lint.
Chose Setting-default.
At this opened file, find line 81.
// skip errors and warnings (e.g. ["E303", "E4", "W"])
"ignore": [],`
then add “W191” in square brackets [] and save.
Good luck!!! ^^
answered Jan 14, 2016 at 13:49
For SublimeText 3 & pycodestyle:
Select Preferences > Package Settings > SublimeLinter > Settings and add / change to this:
// SublimeLinter Settings - User
{
"linters": {
// The name of the linter you installed
"pycodestyle": {
"ignore": ["W191"]
}
}
}
answered Nov 2, 2018 at 12:28
drctdrct
3614 silver badges12 bronze badges
Comments
IanLee1521
added a commit
that referenced
this issue
Jun 3, 2016
This test passes currently, but would need to be updated if the functionality changes.
IanLee1521
added a commit
that referenced
this issue
Jun 6, 2016
This test passes currently, but would need to be updated if the functionality changes.
IanLee1521
added a commit
that referenced
this issue
Jun 6, 2016
This test passes currently, but would need to be updated if the functionality changes.
asottile
changed the title
erroneously checks indentation within triple-quoted strings
W191: erroneously checks indentation within triple-quoted strings
Jun 14, 2020
Indentation has tabs when only spaces are expected. Change all tabs to spaces.
Anti-pattern
Note: →
represents a tab.
def get_name(self):
if self.first_name and self.last_name:
→ → return self.first_name + ' ' + self.last_name
else:
return self.last_name
Best practice
Use spaces only.
def get_name(self):
if self.first_name and self.last_name:
return self.first_name + ' ' + self.last_name
else:
return self.last_name
Additional links
- https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
The project uses the standard pycodestyle (formerly pep8
) configuration files; just add an ignore
line:
[pycodestyle]
ignore = W191
where W191
is the error code for indentation contains tabs
.
You can use set sublime as:
view -> Indentation -> Convert indentation to spaces
This will enable your tabs to be converted to 4(according your setting) spaces. It works on my machine.
And modify the existing tabs in the file to spaces:
View -> Indentation -> Convert Indentation to Spaces
Sublime Text 3 – Disable Python Checker warning indentation contains tabs
in sublime 2
select Prefences > Package setting > Python Fake8 Lint.
Chose Setting-default.
At this opened file, find line 81.
// skip errors and warnings (e.g. [E303, E4, W])
ignore: [],`
then add W191 in square brackets [] and save.
Good luck!!! ^^
Вопрос:
Я не нашел ответа на этот вопрос в Интернете, поэтому я скажу это заранее; это НЕ вопрос о SublimeLinter, и я НЕ хочу отформатировать мой код на Python в соответствии со стандартами PEP8.
Как отключить предупреждение “Отступ содержит вкладки” в пакете Python Checker?
Лучший ответ:
Ответ №1
Вы можете использовать set sublime как:
view → Отступ → Преобразование отступов в пробелы
Это позволит конвертировать ваши вкладки в 4 (по вашим настройкам) пространства. Он работает на моей машине.
И измените существующие вкладки в файле на пробелы:
Просмотр → Отступ → Преобразование отступов в пробелы
Ответ №2
в возвышенном 2
выберите Prefences > Package > Python Fake8 Lint.
Выберите настройку по умолчанию.
В этом открывшемся файле найдите строку 81.
// skip errors and warnings (e.g. ["E303", "E4", "W"])
"ignore": [],`
затем добавьте “W191” в квадратные скобки [] и сохраните.
Удачи!!! ^^