check for uncommitted git changes to identify outdated generated content during continuous integration
Project description
check_uncommitted_git_changes
check_uncommitted_git_changes
is a command line tool to check for
uncommitted git changes to identify outdated generated content during
continuous integration.
The problem
While generated code generally should not be committed, there are cases for
where it can make sense, for example *.po
files containing translations that
are derived from source code.
Developers might change the underlying source code but forget to generate the files derived from it. This causes headache for the next developer who wants to a translated message while implementing a separate task, and not has to deal with the outdated content in some way.
The solution
If your project uses continuous integration, you can use it to run the code generators. Ideally they produce the same code that has already been committed to the repository.
However, if a developer forgot to commit up to date generated code, the code generators will produce slightly different code that can for example be viewed using
git status
Calling check_uncommitted_git_changes
after the generators have run can
check for such changes. If there are none, its exit code is 0 and
continuous integration can continue. If changes are found, the exit code is
1 and continuous integration fails.
Usage
Add check_uncommitted_git_changes
to your projects using the respective
command depending on how you manage your Python packages.
For poetry, run:
poetry add --dev check_uncommitted_git_changes
For setuptools, run:
pip install --upgrade check_uncommitted_git_changes
or add an entry to your *requirements.txt
.
The following example outlines a GitHub action step that first collects all translated messages of a Django project and then checks if they differ from the versions found in the repository:
...
jobs:
build:
...
steps:
...
- name: Check that translations are up to date
run: |
python manage.py makemessages --all --ignore venv --no-location --no-obsolete
check_uncommitted_git_changes
The same principle can be applied to other continuous integration platforms.
License
Check_uncommitted_git_changes
is open source and distributed under the BSD
license. The source code is available from
https://github.com/roskakori/check_uncommitted_git_changes.
Change history
See "CHANGES".
Development and contributing
For information on how to build the project and contribute to it see "CONTRIBUTING".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for check_uncommitted_git_changes-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca5dbc1960ed1670341bb8474e9e5909c8b5e851ef57061e7202efb3f3f78d50 |
|
MD5 | 9880e2ade9d8a961fda17a51a1c191d7 |
|
BLAKE2b-256 | 1679d94418666e8635124e51517a4eecd314a606857d840e88d07720a43429f4 |
Hashes for check_uncommitted_git_changes-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa146d68e540f70c46067ebb8b99a89c40d94e10b17bacff6e50b33d79b7fc39 |
|
MD5 | c492d0dbc35f89c1d982d037560b5685 |
|
BLAKE2b-256 | 74a46171d6e3194515e9ed2129366f9cc438ccd18d20e754fe00381b72998d05 |