refactor: Update coding guidelines to enhance modularity, avoid hardcoding, and improve performance practices
This commit is contained in:
13
.github/instructions/copilot.instructions.md
vendored
13
.github/instructions/copilot.instructions.md
vendored
@@ -1,9 +1,6 @@
|
||||
---
|
||||
applyTo: '**'
|
||||
---
|
||||
---
|
||||
applyTo: '**'
|
||||
---
|
||||
# AI Coding Guidelines for TheChart Project
|
||||
|
||||
## Project Overview
|
||||
@@ -32,12 +29,15 @@ applyTo: '**'
|
||||
- Use .venv/bin/activate.fish as the virtual environment activation script.
|
||||
- The package manager is uv.
|
||||
- Use ruff for linting and formatting.
|
||||
- The terminal uses fish shell.
|
||||
|
||||
### 2. Architecture & Structure
|
||||
- Maintain separation of concerns: UI, data management, and business logic in their respective modules.
|
||||
- Use manager classes (e.g., DataManager, UIManager, ThemeManager) for encapsulating related functionality.
|
||||
- UI elements and data columns must be generated dynamically based on current medicines/pathologies.
|
||||
- New medicines/pathologies should not require changes to main logic—use dynamic lists and keys.
|
||||
- Avoid hardcoding values; use configuration files or constants.
|
||||
- Adopt a modular project structure following python best practices.
|
||||
|
||||
### 3. Error Handling
|
||||
- Use try/except for operations that may fail (file I/O, data parsing).
|
||||
@@ -68,16 +68,21 @@ applyTo: '**'
|
||||
### 8. Performance
|
||||
- Use efficient methods for updating UI elements (e.g., batch delete/insert for Treeview).
|
||||
- Avoid unnecessary data reloads or UI refreshes.
|
||||
- Use multi-threading when appropriate.
|
||||
|
||||
## When Generating or Reviewing Code
|
||||
- Respect the modular structure—add new logic to the appropriate manager or window class.
|
||||
- Do not hardcode medicine/pathology names—always use dynamic keys from the managers.
|
||||
- Preserve user feedback (status bar, dialogs) for all actions.
|
||||
- Maintain keyboard shortcut support for new features.
|
||||
- Code Refactoring is allowed as long as it does not change the external behavior of the code.
|
||||
- Ensure compatibility with the existing UI and data model.
|
||||
- Write clear, concise, and maintainable code with proper type hints and docstrings.
|
||||
- Avoid using deprecated imports or patterns.
|
||||
- Remove any warnings or deprecation notices from the codebase.
|
||||
- Replace legacy code.
|
||||
|
||||
---
|
||||
|
||||
**Summary:**
|
||||
This project is a modular, extensible Tkinter application for tracking medication and pathology data. Code should be clean, dynamic, user-friendly, and robust, following PEP8 and the architectural patterns already established. All new features or changes should integrate seamlessly with the existing managers and UI paradigms.
|
||||
This project is a modular, extensible Tkinter application for tracking medication and pathology data. Code should be clean, dynamic, user-friendly, and robust, following PEP8 and the architectural patterns already established. All new features or changes should integrate seamlessly with the existing managers and UI paradigms, unless instructed otherwise.
|
||||
|
||||
Reference in New Issue
Block a user