Structura
A code refactor tool.
Overview
I built a small desktop app that helps developers find messy parts in their Python code, things like long methods or poorly structured functions. The tool lets you upload any .py file, scans it using Python’s AST (Abstract Syntax Tree), and instantly shows which areas might need cleanup.
What It Does
The tool analyzes uploaded Python files and detects:
● Long Methods: Functions exceeding 15 lines.
● Long Parameter Lists: Functions with too many parameters (4 or more).
● Duplicated Code: Functions that are too similar, identified using Jaccard Similarity.
When duplication is found, the tool even offers an option to refactor it automatically and generate a cleaner version of the code.
How It Works
Working with Tkinter taught me a lot about event handling and UX for desktop apps. I also got comfortable parsing code and understanding how static analysis tools actually work under the hood.
● Built with Tkinter, the interface lets users upload, analyze, and refactor files through simple clicks.
● Under the hood, it uses Python’s AST (Abstract Syntax Tree) module to parse and understand code structure.
● Every detection function was implemented, tested, and refined to handle real-world edge cases.
Why It Matters
This project brought together software design principles and real-world debugging practice, from understanding what makes code “smelly” to learning how to detect and fix it programmatically. It also taught me how GUI tools can make static analysis more approachable for developers.
Tech Stack
Python · Tkinter · AST (Abstract Syntax Tree) · Jaccard Similarity · OOP
Outcome
The tool is fully implemented and tested. It detects multiple code smells, allows refactoring, and provides an intuitive GUI experience, making it both a learning exercise and a genuinely usable mini-tool.