This repository contains a single Python script that runs pre-merge jobs on most recently changed files. These jobs encompass formatting, linting, and copyright management for both Python and C++ files.
To set up the pre-merge job runner, follow these steps:
-
Add as a Submodule
You may integrate this as a submodule in your existing repository. Navigate to your project root folder and add
premerge
using the following command:git submodule add https://github.com/wengchenyang1/premerge.git premerge
-
Run the Setup Script
bash ./premerge/setup.sh
The
setup.sh
script will set up necessary configurations, such as copying template config files for linting and formatting to the root folder (if there are not any).
To run the pre-merge checks, execute the following command in your project root directory:
python premerge/pre_merge.py
This setup script and accompanying pre-merge checks are designed for quick implementation and execution of a series of verification tasks in small projects. While it serves well for basic use cases, it may not be the optimal solution for larger projects with more complex requirements.
The single-file structure of this setup may limit its extensibility and scalability. For more extensive projects, consider using more sophisticated tools and frameworks that are specifically designed for larger codebases and more intricate workflows.
See issues.