Modern Python Projects Transcripts
Chapter: Writing code
Lecture: Multiple linters in VS Code

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We saw that both flake 8 and pylint found different errors in our code,
0:05 so you might be hesitating Which one will be better?
0:09 Well, the good news is that you can actually use both of them at the
0:12 same time, but it's quite tricky to enable it in the VSCode.
0:17 As you saw when we changed the linter using the command palette,
0:20 the previously linter was disabled. But if you go to the documentation of VSCode
0:25 you can see that you can enable multiple linters.
0:30 But you have to manually edit settings.
0:33 And if you use the select linter comment from the command palette,
0:37 it will override your settings. So, when you set up multiple linters,
0:41 make sure that you don't use the Select linter Command.
0:44 So let's go back to VSCode and let's try to enable both Flake 8
0:48 and Pylint. Let's open the settings.
0:53 And now let's open the settings
0:54 Json file. This is basically the Json files storing all your custom settings.
1:00 So whenever you change something in this interface,
1:03 it gets safe in this Json file.
1:06 As you can see here, we have two options pylintEnabled that it's set to
1:10 true and flake8Enabled that it's set to false, if you don't have those two
1:15 options, so let's try to remove them all you have to do.
1:21 It's the first select flake8 Linter,
1:24 then select pylint Linter, and this will add those options to Json file.
1:29 So, let's go back here and here It is like I enabled pylint enabled.
1:35 So each time you change your Linter, VSCode disables the previous one and enables
1:39 only new one option, all we have to do is to put true to both
1:44 linters. Let's close this file and here we have it, lot of errors,
1:50 Some of them comes from FLake 8.
1:53 Some of them comes from pylint,
1:54 so it might be annoying to see all those errors.
1:57 But on the other hand, if you fix all of them, then you can be sure that your code is actually pretty good.