A comprehensive Python linting and formatting extension for Visual Studio Code that enforces consistent code style and automatically fixes common issues.
- System β External β Project import grouping
- Automatic sorting and deduplication
- Proper spacing between import groups
- Multi-line import support with parentheses
- Quote standardization (double to single quotes)
- Line length management (85 characters with smart wrapping)
- Function/class formatting with proper indentation
- Spacing rules (2 lines before classes, 1 line before methods)
- Green highlighting for issues in the editor
- Hover messages with detailed explanations
- Problems panel integration
- Auto-fix on save (configurable)
- Status bar button for quick access
- Keyboard shortcuts (
Ctrl+Shift+Q) - Context menu integration
- Progress indicators during formatting
- Download the VSIX file from releases
- Install in VS Code:
code --install-extension python-lint-fixer-0.1.0.vsix
- Reload VS Code and open a Python file
- Click the lightbulb button in the status bar or press
Ctrl+Shift+Q
Before:
import random,math
def generate_values():
for i in range(0,10):print(i*random.random())
class Dummy:passAfter:
import math
import random
def generate_values():
for i in range(0, 10):
print(i * random.random())
class Dummy:
pass| Code | Description | Auto-fixable |
|---|---|---|
| PLF001 | Line exceeds maximum length | β |
| PLF002 | Use single quotes instead of double quotes | β |
| PLF003 | Multiple imports should be on separate lines | β |
| PLF004 | Classes should be preceded by 2 blank lines | β |
| PLF005 | Methods should be preceded by 1 blank line | β |
| PLF006 | File should end with a blank line | β |
| PLF007 | Import groups should be separated by at least 1 blank line | β |
python-lint-fixer.fixFile- Fix current Python filepython-lint-fixer.fixWorkspace- Fix all Python files in workspace
Ctrl+Shift+Q- Fix current Python file (when Python file is active)
import os
import sys
from datetime import datetimeimport django
import requests
from flask import Flaskfrom users.models import User
from users.views import UserView
from project.models import Project
from project.handlers import ProjectHandler- Node.js (v14 or higher)
- npm
- VS Code
-
Clone the repository:
git clone <repository-url> cd python-lint-fixer
-
Install dependencies:
npm install
-
Compile the extension:
npm run compile
-
Package the extension:
npx vsce package
-
Install the extension:
code --install-extension python-lint-fixer-0.1.0.vsix
python-lint-fixer/
βββ src/
β βββ extension.ts # Main extension entry point
β βββ pythonLinter.ts # Linting logic and diagnostics
β βββ pythonFormatter.ts # Auto-fixing functionality
βββ test/ # Test files
βββ logo.svg # Extension logo
βββ package.json # Extension manifest
βββ README.md # This file
βββ LICENSE # MIT License
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with VS Code Extension API
- Inspired by Python community coding standards
- Follows PEP 8 guidelines
- Issues: GitHub Issues
- Documentation: Wiki
Made with β€οΈ by Pratik Mandge
