Skip to content

Commit

Permalink
Merge pull request #332 from kartoza/timlinux/issue331
Browse files Browse the repository at this point in the history
We need to fix the widget factory
  • Loading branch information
timlinux authored Sep 29, 2024
2 parents fec261c + 1da7d0a commit e6caea6
Show file tree
Hide file tree
Showing 19 changed files with 540 additions and 1,305 deletions.
15 changes: 10 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ git clone https://github.com/your-username/GEEST.git

Create a branch: Create a new branch for your changes.


```bash
git checkout -b my-feature-branch
```
Expand All @@ -47,17 +46,16 @@ Commit your changes: Write a clear and concise commit message.
git commit -m "Add new feature XYZ"
```


Push your changes: Push the changes to your forked repository.

```bash
git push origin my-feature-branch
```


Open a pull request: Go to the original repository and open a pull request. Include a description of your changes and reference any related issues.

Pull Request Checklist

1. Ensure tests pass: Run all tests locally to confirm they pass.
2. Adhere to coding standards: Ensure your code complies with the project’s coding standards and guidelines.
3. Update documentation: If your change affects documentation, update it accordingly.
Expand All @@ -66,7 +64,12 @@ Coding Standards

See [CODING.md](CODING.md)

Please also read PRE-COMMIT-README.md



Testing

1. Write tests: Include unit tests for new features or bug fixes.
2. Use pytest: Use the pytest framework for testing.
3. Run tests: Ensure all tests pass before submitting a pull request.
Expand All @@ -76,6 +79,7 @@ pytest
```

Compliance

1. Pre-commit hooks: Install and configure pre-commit hooks to enforce coding standards and run tests before committing.
2. GPL-3.0 License: Ensure all contributions comply with the project's GPL-3.0 license.

Expand Down Expand Up @@ -104,17 +108,18 @@ If you have any questions or need help, feel free to open an issue or contact us

Thank you for contributing to GEEST!


## Setting Up the Project

### Cloning the Repository

1. **Fork the repository**: If you haven't already, fork the GEEST repository on GitHub.

2. **Clone your fork**: Clone the forked repository to your local machine.

```bash
git clone https://github.com/your-username/GEEST.git
Add the plugin path: In QGIS, go to Plugins > Manage and Install Plugins > Settings > Plugin Paths and add the path to your GEEST folder.
Add the plugin path: In QGIS, go to Plugins > Manage and Install Plugins > Settings > Plugin Paths and add the path to your GEEST folder.
```

Load the plugin: Enable the GEEST plugin from the Installed tab.

Expand Down
81 changes: 81 additions & 0 deletions PRE-COMMIT-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

# Setting Up Pre-Commit for Python Code Formatting

This guide will walk you through setting up a `pre-commit` hook for automatically formatting all Python files within the `geest` directory using `black`.

## Prerequisites

- **Python 3.x**: Ensure you have Python 3 installed on your machine.
- **pip**: Python's package installer.

## Step 1: Install `pre-commit`

First, you'll need to install the `pre-commit` package. You can do this using `pip`:

```bash
pip install pre-commit
```

## Step 2: Create `.pre-commit-config.yaml`

In the root of your repository, create a file named `.pre-commit-config.yaml`. Add the following configuration to set up `black` as the pre-commit hook for Python code formatting:

```yaml
# .pre-commit-config.yaml
repos:
- repo: https://github.com/psf/black
rev: 24.4.0 # Replace with the version of black you are using
hooks:
- id: black
name: black
language_version: python3
# Restrict black to only the `geest` directory
additional_dependencies: []
args: [geest]
```
- **`repos`**: Defines the hooks to use. Here, we use the `black` formatter from its GitHub repository.
- **`rev`**: Specifies the version of `black`. Make sure to replace it with the version you are using.
- **`args`**: Restricts `black` to format only the Python files within the `geest` directory.

## Step 3: Install the Pre-Commit Hook

Navigate to the root of your repository (where the `.pre-commit-config.yaml` file is located) and install the hook using:

```bash
pre-commit install
```

This command sets up the pre-commit hook so that it will run automatically every time you make a commit.

## Step 4: Run the Hook Manually (Optional)

You can test the hook manually to ensure it works as expected before committing any changes:

```bash
pre-commit run --all-files
```

This will apply `black` formatting to all Python files in the `geest` directory.

## Step 5: Commit Your Changes

Once the hook is installed, every time you make a commit, the `black` formatter will automatically format your Python code within the `geest` directory. If any changes are made by `black`, the commit will fail, allowing you to review the changes before committing again.

## Troubleshooting

If you encounter any issues:
1. Make sure `pre-commit` is installed correctly.
2. Ensure your `.pre-commit-config.yaml` file is correctly configured and located in the root of your repository.
3. Check that you have the correct version of `black`.

## Additional Resources

- [Pre-Commit Documentation](https://pre-commit.com/)
- [Black GitHub Repository](https://github.com/psf/black)

---

After following this guide, you will have a working `pre-commit` hook that formats all Python files in the `geest` directory using `black` before every commit.

Enjoy coding with consistent formatting! 🚀
Binary file removed core
Binary file not shown.
Loading

0 comments on commit e6caea6

Please sign in to comment.