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, so you might be hesitating Which one will be better?
0:10 Well, the good news is that you can actually use both of them at the same time, but it's quite tricky to enable it in the VSCode.
0:18 As you saw when we changed the linter using the command palette, the previously linter was disabled. But if you go to the documentation of VSCode
0:26 you can see that you can enable multiple linters. But you have to manually edit settings.
0:34 And if you use the select linter comment from the command palette, it will override your settings. So, when you set up multiple linters,
0:42 make sure that you don't use the Select linter Command. So let's go back to VSCode and let's try to enable both Flake 8
0:49 and Pylint. Let's open the settings. And now let's open the settings Json file. This is basically the Json files storing all your custom settings.
1:01 So whenever you change something in this interface, it gets safe in this Json file.
1:07 As you can see here, we have two options pylintEnabled that it's set to true and flake8Enabled that it's set to false, if you don't have those two
1:16 options, so let's try to remove them all you have to do. It's the first select flake8 Linter,
1:25 then select pylint Linter, and this will add those options to Json file. So, let's go back here and here It is like I enabled pylint enabled.
1:36 So each time you change your Linter, VSCode disables the previous one and enables only new one option, all we have to do is to put true to both
1:45 linters. Let's close this file and here we have it, lot of errors, Some of them comes from FLake 8. Some of them comes from pylint,
1:55 so it might be annoying to see all those errors.
1:58 But on the other hand, if you fix all of them, then you can be sure that your code is actually pretty good.


Talk Python's Mastodon Michael Kennedy's Mastodon