Spaces:
Build error
A newer version of the Streamlit SDK is available: 1.56.0
title: Code Smell Detector
emoji: ๐ป
colorFrom: yellow
colorTo: yellow
sdk: streamlit
sdk_version: 1.44.1
app_file: app.py
pinned: false
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
๐ Python Code Smell Detector
A user-friendly web application for detecting code quality issues in Python codebases. Analyze your Python files to find potential problems before they lead to maintenance headaches.
๐ Introduction
The Python Code Smell Detector is an interactive tool that helps developers identify potential issues in their Python code. It automatically detects common "code smells" that might indicate deeper problems in your codebase.
What are Code Smells?
Code smells are patterns in code that suggest potential design or implementation problems. They're not bugs, but they might lead to bugs or make your code harder to maintain in the future.
Why Use This Tool?
- Improve Code Quality: Identify problematic patterns early
- Reduce Technical Debt: Fix issues before they compound
- Enhance Maintainability: Make your codebase easier to work with
- Learn Better Practices: Understand common pitfalls to avoid
Features
๐ Code Smell Detection
The tool currently detects the following code smells:
- Long Functions: Functions that exceed a configurable line limit
- Too Many Parameters: Functions with excessive parameters
- Duplicate Code: Repeated blocks of code that could be refactored
๐ Analysis Report
- Visual indicators of detected issues
- Detailed explanation of each code smell
- Downloadable markdown report for sharing with your team
๐ Setup
Prerequisites
- Python 3.6+
- pip (Python package installer)
Here's the markdown code for your installation instructions:
Installation
- Clone the repository:
git clone https://github.com/yourusername/code-smell-detector.git
cd code-smell-detector
- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Running Locally
Start the Streamlit server:
streamlit run app.py
The application will open in your default web browser at http://localhost:8501.
๐ง How to Use
Upload Your Python File:
- Click the "Choose a Python file" button
- Select any
.pyfile from your computer
Configure Detection Settings (in the sidebar):
- Adjust the block size for duplicate detection
- Set the maximum function length threshold
- Configure the maximum parameter count
Review Results:
- The tool displays detected issues categorized by type
- Expand duplicate code blocks to see the actual duplicated code
Download Report:
- Click "Generate Download Report" in the sidebar
- Save the markdown file for future reference or team sharing
๐ฎ Upcoming Features
Automatic Refactoring
I will be working on a new feature that will not only detect issues but also suggest or automatically implement refactoring solutions:
- Extract Method transformations for long functions
- Parameter Object creation for functions with too many parameters
- Extract Duplicate code into shared functions
- Preview Changes before applying them
- Apply Refactoring directly to your code with one click
Made with โค๏ธ by [Najmi Hassan]