Certainly! Here's a detailed README.md for your VS Code extension that explains the current functionality, folder structure, future updates, and instructions for use in simple, easy-to-understand language:
Clean Code Assistant (Chapters 1-9)
Version: 0.0.2
The Clean Code Assistant is a VS Code extension that helps developers write cleaner, more maintainable code by checking for violations of Clean Code principles from Chapters 1 to 9 of Robert C. Martin's Clean Code book. The extension supports Python, JavaScript, and Dart.
🌟 What Does It Do?
- This extension checks your code for common issues like:
- Lines longer than 100 characters.
- Unclear variable and function names (like using
x , y , etc.).
- Too many nested
if statements (more than 3).
- Inconsistent indentation.
- Public data exposure (e.g., public fields or methods that should be private).
- Unnecessary comments (comments that state the obvious and clutter the code).
- Empty catch blocks and generic exception handling.
- Functions that are too long or too deeply nested.
- Classes with too many methods or properties.
- Test functions without assertions.
🌟 How to Use This Extension
Install the Extension:
- First, install this extension in VS Code.
- You can do this by searching for "Clean Code Assistant" in the VS Code Extensions marketplace and hitting Install.
Open Your Code Files:
- This extension works on Python, JavaScript, and Dart files. So open any
.py , .js , or .dart file in your workspace.
Check for Issues:
- The extension automatically checks for Clean Code issues as soon as you open your file or when you make changes.
- If it finds a problem (like a line that’s too long or a name that’s too short), you will see a warning in the Problems Panel (bottom of your screen).
- You can also hover over the problematic code to see the warning.
Fix the Issues:
- After you see the warning, you can fix the issue (e.g., shorten a long line or use a more meaningful variable name).
- The warnings will disappear once the issue is resolved!
Example:
- If you have this code:
# This is a comment
x = 10 # Short variable name (not clear)
def calc(a, b): return a * b + (a if b > 10 else 0) # Line exceeds 100 characters
The extension will warn you:
- "Short variable or function name detected."
- "Line exceeds 100 characters."
- After you change the code to:
# This is a comment
totalAmount = 10
def calculateTotal(amount, multiplier): return amount * multiplier + (amount if multiplier > 10 else 0)
The warnings will disappear, and you will have cleaner code!
🔮 Future Updates (What’s Coming Next!)
Here are some exciting updates we are working on for future versions of the extension:
Auto-Fix Suggestions:
- The extension will not only warn you about bad practices but will also provide auto-fix suggestions! For example, if your line is too long, we’ll offer to split it for you.
Support for More Languages:
- We’re planning to extend support to other popular languages like TypeScript, Java, and Kotlin.
Customizable Rules:
- You will be able to customize the rules based on your team's coding style. For example, if your team prefers 100 characters per line instead of 80, you can change that!
AI-Powered Refactoring:
- We are working on adding AI-powered refactoring that will not only detect bad code but will automatically suggest improvements based on Clean Code principles.
Advanced Code Metrics:
- The extension will calculate metrics like function complexity and code duplication, giving you deeper insights into your code quality.
🔧 Development Guide
If you are contributing or working on the extension:
To Build the Extension:
- Clone the repository.
- Run
npm install to install dependencies.
- Run
npm run build to compile the TypeScript into JavaScript.
- Press
F5 in VS Code to start a new development window with the extension running.
👥 Contributing
We welcome contributions! Whether you want to add new features, fix bugs, or improve documentation, feel free to create a pull request.
If you have any questions or need help, feel free to open an issue in the GitHub repository or contact us at @gmail.com.
| |