|
1 | 1 | # Contributing to Python Code Validator
|
2 | 2 |
|
3 |
| -First off, thank you for considering contributing! This project is a community effort, and we welcome any contribution, |
4 |
| -from fixing a typo to implementing a new feature. |
| 3 | +First and foremost, thank you for considering contributing to this project! We welcome any and all contributions, from |
| 4 | +fixing a typo in the documentation to implementing a brand new validation rule. |
5 | 5 |
|
6 |
| -## Where to start? |
| 6 | +This document provides guidelines to ensure that contributing is a smooth and effective process for everyone involved. |
7 | 7 |
|
8 |
| -- **Bug Reports:** If you found a bug, please check if it has already been reported in |
9 |
| - the [Issues](https://github.com/Qu1nel/PythonCodeValidator/issues). If not, please submit a new one using our "Bug |
10 |
| - Report" template. |
11 |
| -- **Feature Requests:** Have an idea for a new feature or an enhancement? We'd love to hear it! Please use the "Feature |
12 |
| - Request" or "Enhancement Request" templates in the [Issues](https://github.com/Qu1nel/PythonCodeValidator/issues). |
13 |
| -- **Questions:** If you have questions about how to use the validator or how it works, feel free to ask using the " |
14 |
| - Question or Support Request" template. |
| 8 | +## Table of Contents |
15 | 9 |
|
16 |
| -## Development Workflow |
| 10 | +- [Code of Conduct](#code-of-conduct) |
| 11 | +- [How Can I Contribute?](#how-can-i-contribute) |
| 12 | + - [Reporting Bugs](#reporting-bugs) |
| 13 | + - [Suggesting Enhancements or New Features](#suggesting-enhancements-or-new-features) |
| 14 | + - [Submitting Pull Requests](#submitting-pull-requests) |
| 15 | +- [Development Setup](#development-setup) |
| 16 | +- [Styleguides](#styleguides) |
| 17 | + - [Git Commit Messages](#git-commit-messages) |
| 18 | + - [Python Styleguide](#python-styleguide) |
| 19 | +- [Testing](#testing) |
17 | 20 |
|
18 |
| -To contribute code, please follow these steps: |
| 21 | +## Code of Conduct |
19 | 22 |
|
20 |
| -1. **Fork the repository** and clone it to your local machine. |
21 |
| -2. **Set up the development environment.** We use `uv` for dependency management. From the project root, run: |
22 |
| - ```bash |
23 |
| - make setup |
24 |
| - ``` |
25 |
| - This will create a virtual environment in `.venv/` and install all necessary dependencies. |
26 |
| -3. **Activate the virtual environment:** |
27 |
| - ```bash |
28 |
| - source .venv/bin/activate # On Linux/macOS/WSL |
29 |
| - # or |
30 |
| - .venv\Scripts\activate # On Windows |
31 |
| - ``` |
32 |
| -4. **Create a new branch** for your feature or bug fix: |
33 |
| - ```bash |
34 |
| - git checkout -b feature/my-new-feature |
35 |
| - # or |
36 |
| - git checkout -b fix/some-bug-fix |
37 |
| - ``` |
38 |
| -5. **Make your changes.** As you code, please ensure you follow our coding standards by running: |
39 |
| - ```bash |
40 |
| - make lint |
41 |
| - ``` |
42 |
| -6. **Add or update tests.** All new features must be accompanied by tests. All bug fixes must include a test that |
43 |
| - reproduces the bug. Run the full test suite with: |
| 23 | +By participating in this project, you are expected to uphold our [Code of Conduct](./CODE_OF_CONDUCT.md). Please read it |
| 24 | +before you start. |
| 25 | + |
| 26 | +## How Can I Contribute? |
| 27 | + |
| 28 | +### Reporting Bugs |
| 29 | + |
| 30 | +If you find a bug, please ensure it hasn't already been reported by searching through |
| 31 | +the [GitHub Issues](https://github.com/Qu1nel/PythonCodeValidator/issues). If you're unable to find an open issue |
| 32 | +addressing the problem, |
| 33 | +please [open a new one](https://github.com/Qu1nel/PythonCodeValidator/issues/new?template=1-bug-report.md) using the " |
| 34 | +Bug Report" template. |
| 35 | + |
| 36 | +### Suggesting Enhancements or New Features |
| 37 | + |
| 38 | +We are always open to new ideas! If you have a suggestion for an enhancement to an existing feature or a new feature |
| 39 | +entirely, please open an issue using the appropriate template: |
| 40 | + |
| 41 | +- [**Feature Request**](https://github.com/Qu1nel/PythonCodeValidator/issues/new?template=4-feature-request.md) for new |
| 42 | + ideas. |
| 43 | +- [**Enhancement Request**](https://github.com/Qu1nel/PythonCodeValidator/issues/new?template=5-enhancement-request.md) |
| 44 | + for improving existing functionality. |
| 45 | + |
| 46 | +### Submitting Pull Requests |
| 47 | + |
| 48 | +If you have code to contribute, please submit it as a Pull Request (PR). |
| 49 | + |
| 50 | +1. Fork the repository and create your branch from `main`. |
| 51 | +2. Set up your local development environment (see [Development Setup](#development-setup)). |
| 52 | +3. Make your changes. |
| 53 | +4. Ensure your code lints and passes all tests (see [Styleguides](#styleguides) and [Testing](#testing)). |
| 54 | +5. Update the `README.md` and any other relevant documentation if your changes require it. |
| 55 | +6. Open a new Pull Request, filling out the provided template. |
| 56 | + |
| 57 | +## Development Setup |
| 58 | + |
| 59 | +We use `uv` for package and environment management. The easiest way to get started is with `make`. |
| 60 | + |
| 61 | +1. **Clone the repository:** |
44 | 62 | ```bash
|
45 |
| - make test |
| 63 | + git clone https://github.com/Qu1nel/PythonCodeValidator.git |
| 64 | + cd PythonCodeValidator |
46 | 65 | ```
|
47 |
| -7. **Ensure high test coverage.** Check the coverage report: |
| 66 | +2. **Run the setup command:** |
48 | 67 | ```bash
|
49 |
| - make coverage-html |
| 68 | + make setup |
50 | 69 | ```
|
51 |
| -8. **Update documentation.** If you added or changed a feature, please update the relevant documentation and docstrings. |
52 |
| -9. **Commit your changes.** We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. |
53 |
| - This helps in automating changelogs and versioning. |
54 |
| - * `feat:` for a new feature. |
55 |
| - * `fix:` for a bug fix. |
56 |
| - * `docs:` for documentation changes. |
57 |
| - * `style:` for formatting changes. |
58 |
| - * `refactor:` for code changes that neither fix a bug nor add a feature. |
59 |
| - * `test:` for adding or refactoring tests. |
60 |
| - * `chore:` for build process or auxiliary tool changes. |
61 |
| -10. **Push your branch and open a Pull Request.** Fill out the pull request template to help us understand and review |
62 |
| - your contribution. |
| 70 | + This command will create a virtual environment in `.venv/` and install all necessary dependencies for development. |
63 | 71 |
|
64 |
| -## Code of Conduct |
| 72 | +3. **Activate the virtual environment:** |
| 73 | + * On Linux/macOS: `source .venv/bin/activate` |
| 74 | + * On Windows: `.venv\Scripts\activate` |
| 75 | + |
| 76 | +Now you are ready to start coding! |
| 77 | + |
| 78 | +## Styleguides |
| 79 | + |
| 80 | +### Git Commit Messages |
| 81 | + |
| 82 | +We follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This helps us |
| 83 | +automate versioning and changelogs. Please structure your commit messages accordingly. |
| 84 | + |
| 85 | +Examples: |
| 86 | + |
| 87 | +- `feat: Add new 'must_be_constant' constraint` |
| 88 | +- `fix: Correctly handle relative imports in ImportStatementSelector` |
| 89 | +- `docs: Update README with new installation instructions` |
| 90 | +- `test: Add unit tests for scope_handler` |
| 91 | +- `refactor: Improve performance of AST traversal` |
| 92 | +- `chore: Update CI workflow to use Python 3.12` |
| 93 | + |
| 94 | +### Python Styleguide |
| 95 | + |
| 96 | +Our codebase is automatically formatted and linted using **Ruff**. Before committing, please run: |
| 97 | + |
| 98 | +```bash |
| 99 | +make lint |
| 100 | +``` |
| 101 | + |
| 102 | +This command will format your code and check for any style violations, attempting to fix them automatically. |
| 103 | + |
| 104 | +## Testing |
| 105 | + |
| 106 | +This project maintains a high standard of test coverage. |
| 107 | + |
| 108 | +- **Run the full test suite:** |
| 109 | + ```bash |
| 110 | + make test |
| 111 | + ``` |
| 112 | +- **Run tests with a coverage report:** |
| 113 | + ```bash |
| 114 | + make coverage |
| 115 | + ``` |
| 116 | +- **Generate an interactive HTML coverage report:** |
| 117 | + ```bash |
| 118 | + make coverage-html |
| 119 | + ``` |
| 120 | + This will create a report in the `htmlcov/` directory. |
| 121 | + |
| 122 | +All new features and bug fixes **must** be accompanied by corresponding tests to be accepted. |
65 | 123 |
|
66 |
| -By participating in this project, you are expected to uphold our [Code of Conduct](./CODE_OF_CONDUCT.md). |
| 124 | +--- |
67 | 125 |
|
68 |
| -Thank you for your contribution! |
| 126 | +Thank you again for your interest in contributing! |
0 commit comments