Skip to content

Support linting, formatting, etc through pre-commit #12187

Closed as not planned
Closed as not planned
@paw-lu

Description

@paw-lu

Background

It's become pretty popular to use .pre-commit-config.yaml to define linting, type-checking, and autoformatting dependencies and processes in Python projects. Many projects go as far as to no longer specify flake8 dependencies in their requirements.txt/pyproject.tom/setup.py.

Unfortunately, it seems vscode-python does not play well with pre-commit.

When cloning a project, the most reliable approach I've found it to

  1. Parse the .pre-commit-config.yml for dependencies
  2. Manually create an environment with the linting dependencies
  3. Add the environment path manually to python.linting.pylintPath.

If anyone has a better workflow, I'd love to know!

Proposal

Support pre-commit as a linter, formatter, and type checker. Adding pre-commit as one of these would use pre-commit run to run the appropriate linting steps (e.g. pre-commit run flake8 --files).


Thanks for the project, I've really enjoyed the Python plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-editor-*User-facing catch-allfeature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions