DEV Community

Discussion on: Setting up Python workspace in Visual Studio Code (vscode)

Collapse
 
sobolevn profile image
Nikita Sobolev

There's also one more thing that you can add to this amazing setup: linting!

VSCode can automatically find bugs, refactoring opportunities, and things to improve inside your code. I recommend to use flake8 + wemake-python-styleguide. Here's how to set things up: code.visualstudio.com/docs/python/...

And don't forget to check out wemake-python-styleguide on its own. It is the strictest Python linter out there:

GitHub logo wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!

wemake-python-styleguide

wemake.services Supporters Build Status codecov Python Version wemake-python-styleguide


Welcome to the strictest and most opinionated Python linter ever.

wemake-python-styleguide logo

wemake-python-styleguide is actually a flake8 plugin with some other plugins as dependencies.

Quickstart

pip install wemake-python-styleguide
Enter fullscreen mode Exit fullscreen mode

You will also need to create a setup.cfg file with the configuration.

Try it online!

We highly recommend to also use:

  • flakeheaven for easy integration into a legacy codebase
  • nitpick for sharing and validating configuration across multiple projects

Running

flake8 your_module.py
Enter fullscreen mode Exit fullscreen mode

This app is still just good old flake8 And it won't change your existing workflow.

invocation results

See "Usage" section in the docs for examples and integrations.

We also support GitHub Actions as first class-citizens Try it out!

Strict is the new cool

Strict linting offers the following benefits to developers and companies:

  1. Ensures consistency - no matter who works on it, the end product will always be the same dependable code
  2. Helps avoid potential bugs - strict rules make…
Collapse
 
idrisrampurawala profile image
Idris Rampurawala

I have already added pylint for code linting. Choosing formatter and linter is I believe a personal choice. This post is just about how to get started and not a discussion around python linters.

On a personal note, thanks for sharing this, I will definitely give it a try for one of my side projects :)