Please don't treat this as an "asked and answered" question. I sincerely have been clobbering to try to figure out why this has stopped working, if it's a VS Code problem, or a Flake8 one, or if I'm just crazy and should find another way around this.
Looking for a way to stop the Flake8 linter's "file is too long" and "not used" warnings, I found a solution listed as one of the hottest on StackFlow. I copied and pasted it exactly and it worked! Great, but while following Django Project tutorial on this code in admin.py file:
from django.contrib import admin
from .models import Choice, Question
class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
]
inlines = [ChoiceInline]
admin.site.register(Question, QuestionAdmin)
suddenly, (the setting had been working fine for days), I got this Problem warning: line too long(80 > 79 characters) flake8(E501) (13,80)
I know I may be too picky on this but it is really annoying. I've also read that I can break the line up using a backslash without breaking the continuity of the code, but I also tried that and got a message saying that the backslash is redundant within brackets.
I went back to the settings and checked that they're still exactly as the Args suggested that had in fact worked. I removed the changes. I closed and re-started VS Code, went back and reinserted the settings again. Still getting the same error and I don't know from where Flake8 is getting and reproducing the error message with the 80 being greater than 79 information.
Does anyone have an idea of why the settings just suddenly stopped working and flake8 reverted back to ignoring the arguments it was directed to ignore in the settings?
This was the hot solution that stopped working for me: VS Code, Preferences, User Settings, Extensions, Python, Linting, Flake8 Args
"python.linting.flake8Args": [
"--max-line-length=120",
"--ignore=E402,F841,F401,E302,E305",
],
I even tried extending the line length to 180 and adding E501 to the ignore list. Nothing works.