From 2396781d66fb8a94a2ca980fde0bf0363c6a7b0b Mon Sep 17 00:00:00 2001 From: William Valentin Date: Sun, 10 Aug 2025 09:38:51 -0700 Subject: [PATCH] refactor: Update coding guidelines to enhance modularity, avoid hardcoding, and improve performance practices --- .github/instructions/copilot.instructions.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/instructions/copilot.instructions.md b/.github/instructions/copilot.instructions.md index 00dafdf..bb68238 100644 --- a/.github/instructions/copilot.instructions.md +++ b/.github/instructions/copilot.instructions.md @@ -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.