From 84f4812189d989b716bef9d7ef423e4707ff4d12 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 13 Feb 2025 10:48:49 +0000 Subject: [PATCH] Update CONTRIBUTING.md --- CONTRIBUTING.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 53b9f3ab..096f236b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,18 +35,40 @@ Tech Stack Overview: - πŸ–₯ Backend: Developed in Python 🐍 -### 🌐 If you are looking to contribute to frontend (βš›οΈReact, Vite): +### 🌐 Frontend Contributions (βš›οΈ React, Vite) +* The updated Figma design can be found [here](https://www.figma.com/file/OXLtrl1EAy885to6S69554/DocsGPT?node-id=0%3A1&t=hjWVuxRg9yi5YkJ9-1). Please try to follow the guidelines. +* **Coding Style:** We follow a strict coding style enforced by ESLint and Prettier. Please ensure your code adheres to the configuration provided in our repository's `fronetend/.eslintrc.js` file. We recommend configuring your editor with ESLint and Prettier to help with this. +* **Component Structure:** Strive for small, reusable components. Favor functional components and hooks over class components where possible. +* **State Management** If you need to add stores, please use Redux. -- The updated Figma design can be found [here](https://www.figma.com/file/OXLtrl1EAy885to6S69554/DocsGPT?node-id=0%3A1&t=hjWVuxRg9yi5YkJ9-1). - -Please try to follow the guidelines. - -### πŸ–₯ If you are looking to contribute to Backend (🐍 Python): +### πŸ–₯ Backend Contributions (🐍 Python) - Review our issues and contribute to [`/application`](https://github.com/arc53/DocsGPT/tree/main/application) - All new code should be covered with unit tests ([pytest](https://github.com/pytest-dev/pytest)). Please find tests under [`/tests`](https://github.com/arc53/DocsGPT/tree/main/tests) folder. - Before submitting your Pull Request, ensure it can be queried after ingesting some test data. +- **Coding Style:** We adhere to the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide for Python code. We use `ruff` as our linter and code formatter. Please ensure your code is formatted correctly and passes `ruff` checks before submitting. +- **Type Hinting:** Please use type hints for all function arguments and return values. This improves code readability and helps catch errors early. Example: + + ```python + def my_function(name: str, count: int) -> list[str]: + ... + ``` +- **Docstrings:** All functions and classes should have docstrings explaining their purpose, parameters, and return values. We prefer the [Google style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html). Example: + + ```python + def my_function(name: str, count: int) -> list[str]: + """Does something with a name and a count. + + Args: + name: The name to use. + count: The number of times to do it. + + Returns: + A list of strings. + """ + ... + ``` ### Testing