🐍 Python Lint Fixer

A comprehensive Python linting and formatting extension for Visual Studio Code that enforces consistent code style and automatically fixes common issues.

✨ Features
🎯 Smart Import Organization
- 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)
🚀 Real-time Linting
- Green highlighting for issues in the editor
- Hover messages with detailed explanations
- Problems panel integration
- Auto-fix on save (configurable)
🎨 User Experience
- Status bar button for quick access
- Keyboard shortcuts (
Ctrl+Shift+Q
)
- Context menu integration
- Progress indicators during formatting
🚀 Quick Start
Installation
- 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
Usage
Before:
import random,math
def generate_values():
for i in range(0,10):print(i*random.random())
class Dummy:pass
After:
import math
import random
def generate_values():
for i in range(0, 10):
print(i * random.random())
class Dummy:
pass
🎯 Error Codes
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 |
✅ |
🔧 Commands
python-lint-fixer.fixFile
- Fix current Python file
python-lint-fixer.fixWorkspace
- Fix all Python files in workspace
⌨️ Keyboard Shortcuts
Ctrl+Shift+Q
- Fix current Python file (when Python file is active)
🎨 Import Organization Rules
System Imports
import os
import sys
from datetime import datetime
External Libraries
import django
import requests
from flask import Flask
Project Imports (grouped by app)
from users.models import User
from users.views import UserView
from project.models import Project
from project.handlers import ProjectHandler
🛠️ Development
Prerequisites
- Node.js (v14 or higher)
- npm
- VS Code
Building from Source
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
Project Structure
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
🤝 Contributing
- 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
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
📞 Support
Made with ❤️ by Pratik Mandge