Detects Long Method, Long Parameter List, and Large Class code smells in Python files in real-time using a trained Random Forest classifier.
What it does
- Underlines the function or class name in yellow when a smell is detected
- Hover over the underline to see the smell type, metric value, and confidence score
- Click "Show Refactoring Example" in the tooltip to open a side-by-side unsaved Python file with before/after refactoring examples specific to that smell
- A lightbulb code action also appears on flagged lines
- Runs automatically on file save
Limitations
- For Mac and Linux user, you need to install the dependencies such as joblib, scikit-learn, numpy, and pandas first.
Settings
| Setting | Default | Description |
|---|---|---|
codeSmellDetector.pythonPath |
python |
Python executable path |
codeSmellDetector.confidenceThreshold |
0.5 |
Minimum confidence to flag (0–1) |
Credit
This extension is made possible as an advancement on research done by Vatanapakorn et al. (Vatanapakorn, N., Soomlek, C., & Seresangtakul, P. (2022). Python Code Smell Detection Using Machine Learning. 2022 26th International Computer Science and Engineering Conference (ICSEC), 128–133. https://doi.org/10.1109/ICSEC56337.2022.10049330).