keepmeachangelog 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "uv"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ commit-message:
8
+ prefix: "[skip ci] build(deps):"
9
+ prefix-development: "[skip ci] build(deps-dev):"
10
+ open-pull-requests-limit: 10
11
+ allow:
12
+ - dependency-type: "direct"
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
17
+ commit-message:
18
+ prefix: "[skip ci] build(deps):"
19
+ open-pull-requests-limit: 5
@@ -0,0 +1,87 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags:
5
+ - "v*"
6
+ concurrency:
7
+ group: ${{ github.workflow }}
8
+ cancel-in-progress: false
9
+ permissions:
10
+ contents: write
11
+ jobs:
12
+ release:
13
+ name: Release
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v7
18
+
19
+ - name: Read project version
20
+ id: vars
21
+ run: |
22
+ set -euo pipefail
23
+ version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
24
+ if [ "${GITHUB_REF_NAME}" != "v${version}" ]; then
25
+ echo "Tag ${GITHUB_REF_NAME} does not match pyproject.toml version v${version}" >&2
26
+ exit 1
27
+ fi
28
+ echo "project_version=${version}" >> "$GITHUB_OUTPUT"
29
+
30
+ - name: Setup uv
31
+ uses: astral-sh/setup-uv@v10.3.0
32
+
33
+ - name: Lint the changelog with this project
34
+ run: uv run keepmeachangelog --validation-depth 10 --version-from pyproject.toml CHANGELOG.md
35
+
36
+ - name: Run tests
37
+ run: uv run --group test pytest
38
+
39
+ - name: Recupera o histórico da versão para a criação da release
40
+ id: changelog_reader
41
+ uses: mindsers/changelog-reader-action@v2
42
+ with:
43
+ validation_level: error
44
+ validation_depth: 10
45
+ version: ${{ steps.vars.outputs.project_version }}
46
+ path: ./CHANGELOG.md
47
+
48
+ - name: Build
49
+ run: uv build
50
+
51
+ - name: Upload distributions
52
+ uses: actions/upload-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+ if-no-files-found: error
57
+
58
+ - name: Cria a release no Github para a versão
59
+ uses: ncipollo/release-action@v1
60
+ with:
61
+ tag: v${{ steps.vars.outputs.project_version }}
62
+ name: v${{ steps.vars.outputs.project_version }}
63
+ body: ${{ steps.changelog_reader.outputs.changes }}
64
+ artifacts: dist/*
65
+ prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
66
+ draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
67
+ allowUpdates: false
68
+ token: ${{ secrets.GITHUB_TOKEN }}
69
+
70
+ publish-pypi:
71
+ name: Publish to PyPI
72
+ needs: release
73
+ runs-on: ubuntu-latest
74
+ environment:
75
+ name: pypi
76
+ url: https://pypi.org/project/keepmeachangelog/
77
+ permissions:
78
+ id-token: write
79
+ steps:
80
+ - name: Download distributions
81
+ uses: actions/download-artifact@v4
82
+ with:
83
+ name: dist
84
+ path: dist/
85
+
86
+ - name: Publish to PyPI (trusted publishing)
87
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,108 @@
1
+ name: Tests
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - "**"
10
+ paths-ignore:
11
+ - "**.md"
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+ permissions:
16
+ contents: read
17
+ jobs:
18
+ pre-commit:
19
+ name: Pre-commit
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v7
24
+
25
+ - name: Setup python (default_language_version of the pre-commit config)
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.11"
29
+
30
+ - name: Setup uv
31
+ uses: astral-sh/setup-uv@v10.3.3
32
+
33
+ - name: Cache pre-commit environments
34
+ uses: actions/cache@v6
35
+ with:
36
+ path: ~/.cache/pre-commit
37
+ key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
38
+
39
+ - name: Run pre-commit on all files
40
+ run: uvx pre-commit run --all-files --show-diff-on-failure
41
+
42
+ tests:
43
+ name: Tests (python ${{ matrix.python-version }})
44
+ runs-on: ubuntu-latest
45
+ strategy:
46
+ fail-fast: false
47
+ matrix:
48
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
49
+ steps:
50
+ - name: Checkout
51
+ uses: actions/checkout@v7
52
+
53
+ - name: Setup uv
54
+ uses: astral-sh/setup-uv@v10.3.3
55
+
56
+ - name: Run unit tests (100% coverage required)
57
+ run: uv run --python ${{ matrix.python-version }} --group test pytest
58
+
59
+ - name: Coverage summary
60
+ if: ${{ always() && matrix.python-version == '3.14' }}
61
+ run: uv run --python ${{ matrix.python-version }} --group test coverage report --rcfile=pyproject.toml --format=markdown >> "$GITHUB_STEP_SUMMARY"
62
+
63
+ - name: Upload coverage report
64
+ if: ${{ matrix.python-version == '3.14' }}
65
+ uses: actions/upload-artifact@v7
66
+ with:
67
+ name: coverage-xml
68
+ path: coverage.xml
69
+
70
+ coverage-badge:
71
+ name: Coverage badge
72
+ needs: tests
73
+ if: ${{ github.event_name == 'push' }}
74
+ runs-on: ubuntu-latest
75
+ permissions:
76
+ contents: write
77
+ steps:
78
+ - name: Checkout
79
+ uses: actions/checkout@v7
80
+
81
+ - name: Download coverage report
82
+ uses: actions/download-artifact@v7
83
+ with:
84
+ name: coverage-xml
85
+
86
+ - name: Generate badge
87
+ run: python3 scripts/coverage_badge.py coverage.xml "${RUNNER_TEMP}/coverage.svg"
88
+
89
+ - name: Publish badge to the badges branch
90
+ run: |
91
+ set -euo pipefail
92
+ git config user.name "github-actions[bot]"
93
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
94
+ if git ls-remote --exit-code --heads origin badges > /dev/null; then
95
+ git fetch origin badges
96
+ git checkout -f -B badges origin/badges
97
+ else
98
+ git checkout --orphan badges
99
+ git rm -rf . -q
100
+ fi
101
+ cp "${RUNNER_TEMP}/coverage.svg" coverage.svg
102
+ git add coverage.svg
103
+ if git diff --cached --quiet; then
104
+ echo "Badge unchanged"
105
+ else
106
+ git commit -m "chore: update coverage badge"
107
+ git push origin badges
108
+ fi
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ .venv/
3
+ *.egg-info/
4
+ dist/
5
+ .coverage
6
+ coverage.xml
7
+ .pytest_cache/
@@ -0,0 +1,7 @@
1
+ {
2
+ "MD013": false,
3
+ "MD024": false,
4
+ "MD033": false,
5
+ "MD045": false,
6
+ "MD046": false
7
+ }
@@ -0,0 +1,100 @@
1
+ ---
2
+ exclude: '^(cdk\.out)/'
3
+ default_language_version:
4
+ python: python3.11
5
+
6
+ default_install_hook_types:
7
+ - pre-commit
8
+ - pre-merge-commit
9
+
10
+ repos:
11
+ - repo: https://github.com/astral-sh/uv-pre-commit
12
+ rev: 0.13.8
13
+ hooks:
14
+ - id: uv-lock
15
+
16
+ - repo: https://github.com/pre-commit/pre-commit-hooks
17
+ rev: v6.0.0
18
+ hooks:
19
+ - id: trailing-whitespace
20
+ exclude: '\.svg$|\.log$|\.txt$'
21
+ - id: check-added-large-files
22
+ - id: fix-byte-order-marker
23
+ - id: check-docstring-first
24
+ - id: pretty-format-json
25
+ args: [--autofix, --indent=4]
26
+ - id: check-json
27
+ - id: check-merge-conflict
28
+ - id: check-symlinks
29
+ - id: check-toml
30
+ - id: check-vcs-permalinks
31
+ - id: check-xml
32
+ - id: check-yaml
33
+ args: [--unsafe]
34
+ - id: file-contents-sorter
35
+ - id: mixed-line-ending
36
+ - id: name-tests-test
37
+ - id: sort-simple-yaml
38
+
39
+ - repo: https://github.com/astral-sh/ruff-pre-commit
40
+ rev: v0.17.5
41
+ hooks:
42
+ - id: ruff
43
+ args:
44
+ - --fix
45
+ - --config=pyproject.toml
46
+
47
+ - id: ruff-format
48
+ args:
49
+ - --config=pyproject.toml
50
+
51
+ - repo: https://github.com/PyCQA/docformatter
52
+ rev: v1.7.8
53
+ hooks:
54
+ - id: docformatter
55
+ args:
56
+ - --in-place
57
+ - --config=pyproject.toml
58
+
59
+ - repo: https://github.com/adrienverge/yamllint.git
60
+ rev: v1.38.0
61
+ hooks:
62
+ - id: yamllint
63
+ args:
64
+ - -d
65
+ - "{extends: default, rules: {document-start: disable, line-length: disable, truthy: disable, comments-indentation: disable}}"
66
+
67
+ - repo: https://github.com/gitleaks/gitleaks
68
+ rev: v8.30.0
69
+ hooks:
70
+ - id: gitleaks
71
+
72
+ - repo: https://github.com/Mateusz-Grzelinski/actionlint-py
73
+ rev: v1.7.12.25
74
+ hooks:
75
+ - id: actionlint
76
+ additional_dependencies: [shellcheck-py]
77
+
78
+ - repo: https://github.com/igorshubovych/markdownlint-cli
79
+ rev: v0.50.0
80
+ hooks:
81
+ - id: markdownlint
82
+ args: ["--config", ".markdownlint.json", "--fix"]
83
+
84
+ - repo: local
85
+ hooks:
86
+ - id: pyright
87
+ name: pyright
88
+ entry: uv run --group test pyright
89
+ language: system
90
+ types: [python]
91
+ pass_filenames: false
92
+
93
+ - id: no-merge-commit
94
+ name: block merge commits (rebase-only)
95
+ entry: >-
96
+ Merge commit blocked: this project uses rebase only.
97
+ Run: git fetch origin && git rebase origin/dev
98
+ language: fail
99
+ always_run: true
100
+ stages: [pre-merge-commit]
@@ -0,0 +1,8 @@
1
+ - id: keepmeachangelog-lint
2
+ name: keep a changelog lint
3
+ description: Validate CHANGELOG.md against Keep a Changelog 1.1.0
4
+ entry: keepmeachangelog
5
+ language: python
6
+ language_version: python3
7
+ files: (?i)(^|/)changelog(\.md)?$
8
+ types: [text]
@@ -0,0 +1,12 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "useTabs": false,
4
+ "overrides": [
5
+ {
6
+ "files": ["*.json", "*.jsonc"],
7
+ "options": {
8
+ "tabWidth": 4
9
+ }
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.1.0] - 2026-11-16
8
+
9
+ ### Added
10
+
11
+ - Add `keepmeachangelog` command and pre-commit hook that validate a changelog against Keep a Changelog 1.1.0
12
+ - Add the same release rules as `mindsers/changelog-reader-action`: valid SemVer, increasing order, listed items per section and sections allowed per release type
13
+ - Add formatting checks (spacing, section names, headings, version links) and `--fix` to correct them
14
+ - Add `--config`, `--validation-depth`, `--version` and `--version-from` options
15
+
16
+ [Unreleased]: https://github.com/dcotecnologia/keepmeachangelog-lint/compare/v0.1.0...HEAD
17
+ [0.1.0]: https://github.com/dcotecnologia/keepmeachangelog-lint/releases/tag/v0.1.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danilo Carolino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.5
2
+ Name: keepmeachangelog
3
+ Version: 0.1.0
4
+ Summary: Linter for CHANGELOG files following Keep a Changelog 1.1.0
5
+ Project-URL: Homepage, https://github.com/dcotecnologia/keepmeachangelog-lint
6
+ Project-URL: Repository, https://github.com/dcotecnologia/keepmeachangelog-lint
7
+ Project-URL: Changelog, https://github.com/dcotecnologia/keepmeachangelog-lint/blob/main/CHANGELOG.md
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: changelog,keep-a-changelog,lint,linter,pre-commit,semver
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Quality Assurance
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+
19
+ # keepmeachangelog
20
+
21
+ [![Tests](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/tests.yml/badge.svg)](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/tests.yml)
22
+ [![Coverage](https://raw.githubusercontent.com/dcotecnologia/keepmeachangelog-lint/badges/coverage.svg)](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/tests.yml)
23
+ [![Release](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/release.yml/badge.svg)](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/release.yml)
24
+ [![Latest release](https://img.shields.io/github/v/release/dcotecnologia/keepmeachangelog-lint)](https://github.com/dcotecnologia/keepmeachangelog-lint/releases/latest)
25
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
26
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://pre-commit.com/)
27
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
28
+ [![Keep a Changelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog%201.1.0-E05735)](https://keepachangelog.com/en/1.1.0/)
29
+ [![SemVer](https://img.shields.io/badge/semver-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
30
+
31
+ Linter for changelogs following [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/).
32
+
33
+ ## pre-commit
34
+
35
+ ```yaml
36
+ repos:
37
+ - repo: https://github.com/dcotecnologia/keepmeachangelog-lint
38
+ rev: v0.1.0
39
+ hooks:
40
+ - id: keepmeachangelog-lint
41
+ args: [--fix]
42
+ ```
43
+
44
+ ### Pointing at a specific file
45
+
46
+ By default the hook runs on files named `CHANGELOG` / `CHANGELOG.md` (any directory).
47
+ To lint a differently named or located file, override `files` in your config:
48
+
49
+ ```yaml
50
+ - id: keepmeachangelog-lint
51
+ files: ^docs/HISTORY\.md$
52
+ ```
53
+
54
+ To lint a file even when it is not staged, add `always_run: true` and `pass_filenames: false`
55
+ with the path as an argument:
56
+
57
+ ```yaml
58
+ - id: keepmeachangelog-lint
59
+ args: [docs/HISTORY.md]
60
+ pass_filenames: false
61
+ always_run: true
62
+ ```
63
+
64
+ Or run directly: `keepmeachangelog CHANGELOG.md`.
65
+
66
+ ## Config
67
+
68
+ `--config path/to/file.toml` (keys at top level, or under `[tool.keepmeachangelog]`
69
+ so you can point at a `pyproject.toml`):
70
+
71
+ ```toml
72
+ title = "Changelog" # expected "# <title>"
73
+ sections = ["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]
74
+ require-links = true # each version needs a "[x.y.z]: url"
75
+ allow-empty-sections = false
76
+ validation-depth = 10 # optional: only the latest N released versions (Unreleased not counted); omit = all
77
+ version = "1.4.0" # optional: the changelog must have an entry for it
78
+ version-from = "pyproject.toml" # optional: same, read from [project].version
79
+ repo-url = "https://github.com/o/r" # optional: enables generating/fixing version links
80
+ tag-prefix = "v"
81
+ ```
82
+
83
+ `--validation-depth N`, `--version X` and `--version-from pyproject.toml` on the command line override the file.
84
+
85
+ In pre-commit: `args: [--config, .changelog-lint.toml]`.
86
+
87
+ ## Rules
88
+
89
+ - `# Changelog` title
90
+ - Version headings `## [x.y.z] - YYYY-MM-DD` (SemVer, valid ISO date, optional `[YANKED]`) or `## [Unreleased]` (first, no date)
91
+ - Latest version first (by version and date); no duplicate versions
92
+ - Sections only `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`; no duplicates, none empty
93
+ - Each version has a link reference `[x.y.z]: <url>`
94
+
95
+ ### Same checks as `mindsers/changelog-reader-action`
96
+
97
+ So the pre-commit hook fails on whatever would fail the release workflow:
98
+
99
+ - every released version is a valid SemVer; versions are in strictly increasing order (latest first)
100
+ - a section must have listed items (`Unreleased` is exempt)
101
+ - sections allowed by release type, comparing each version with the previous one:
102
+ patch: `Fixed`, `Security`; minor: also `Added`, `Changed`, `Deprecated`; major/other: also `Removed`
103
+ - `validation-depth` counts the newest N released versions (Unreleased excluded); the oldest one in the window is not compared with a predecessor
104
+ - `--version-from pyproject.toml` fails if the changelog has no entry for the project version (the action's "No log entry found for version X")
105
+
106
+ Not covered: `version_scheme: pep440`. Note the action only validates when `validation_level` is `warn` or `error` (default `none`).
107
+
108
+ ## License
109
+
110
+ [MIT](LICENSE)
@@ -0,0 +1,92 @@
1
+ # keepmeachangelog
2
+
3
+ [![Tests](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/tests.yml/badge.svg)](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/tests.yml)
4
+ [![Coverage](https://raw.githubusercontent.com/dcotecnologia/keepmeachangelog-lint/badges/coverage.svg)](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/tests.yml)
5
+ [![Release](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/release.yml/badge.svg)](https://github.com/dcotecnologia/keepmeachangelog-lint/actions/workflows/release.yml)
6
+ [![Latest release](https://img.shields.io/github/v/release/dcotecnologia/keepmeachangelog-lint)](https://github.com/dcotecnologia/keepmeachangelog-lint/releases/latest)
7
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
8
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://pre-commit.com/)
9
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
10
+ [![Keep a Changelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog%201.1.0-E05735)](https://keepachangelog.com/en/1.1.0/)
11
+ [![SemVer](https://img.shields.io/badge/semver-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
12
+
13
+ Linter for changelogs following [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/).
14
+
15
+ ## pre-commit
16
+
17
+ ```yaml
18
+ repos:
19
+ - repo: https://github.com/dcotecnologia/keepmeachangelog-lint
20
+ rev: v0.1.0
21
+ hooks:
22
+ - id: keepmeachangelog-lint
23
+ args: [--fix]
24
+ ```
25
+
26
+ ### Pointing at a specific file
27
+
28
+ By default the hook runs on files named `CHANGELOG` / `CHANGELOG.md` (any directory).
29
+ To lint a differently named or located file, override `files` in your config:
30
+
31
+ ```yaml
32
+ - id: keepmeachangelog-lint
33
+ files: ^docs/HISTORY\.md$
34
+ ```
35
+
36
+ To lint a file even when it is not staged, add `always_run: true` and `pass_filenames: false`
37
+ with the path as an argument:
38
+
39
+ ```yaml
40
+ - id: keepmeachangelog-lint
41
+ args: [docs/HISTORY.md]
42
+ pass_filenames: false
43
+ always_run: true
44
+ ```
45
+
46
+ Or run directly: `keepmeachangelog CHANGELOG.md`.
47
+
48
+ ## Config
49
+
50
+ `--config path/to/file.toml` (keys at top level, or under `[tool.keepmeachangelog]`
51
+ so you can point at a `pyproject.toml`):
52
+
53
+ ```toml
54
+ title = "Changelog" # expected "# <title>"
55
+ sections = ["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]
56
+ require-links = true # each version needs a "[x.y.z]: url"
57
+ allow-empty-sections = false
58
+ validation-depth = 10 # optional: only the latest N released versions (Unreleased not counted); omit = all
59
+ version = "1.4.0" # optional: the changelog must have an entry for it
60
+ version-from = "pyproject.toml" # optional: same, read from [project].version
61
+ repo-url = "https://github.com/o/r" # optional: enables generating/fixing version links
62
+ tag-prefix = "v"
63
+ ```
64
+
65
+ `--validation-depth N`, `--version X` and `--version-from pyproject.toml` on the command line override the file.
66
+
67
+ In pre-commit: `args: [--config, .changelog-lint.toml]`.
68
+
69
+ ## Rules
70
+
71
+ - `# Changelog` title
72
+ - Version headings `## [x.y.z] - YYYY-MM-DD` (SemVer, valid ISO date, optional `[YANKED]`) or `## [Unreleased]` (first, no date)
73
+ - Latest version first (by version and date); no duplicate versions
74
+ - Sections only `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`; no duplicates, none empty
75
+ - Each version has a link reference `[x.y.z]: <url>`
76
+
77
+ ### Same checks as `mindsers/changelog-reader-action`
78
+
79
+ So the pre-commit hook fails on whatever would fail the release workflow:
80
+
81
+ - every released version is a valid SemVer; versions are in strictly increasing order (latest first)
82
+ - a section must have listed items (`Unreleased` is exempt)
83
+ - sections allowed by release type, comparing each version with the previous one:
84
+ patch: `Fixed`, `Security`; minor: also `Added`, `Changed`, `Deprecated`; major/other: also `Removed`
85
+ - `validation-depth` counts the newest N released versions (Unreleased excluded); the oldest one in the window is not compared with a predecessor
86
+ - `--version-from pyproject.toml` fails if the changelog has no entry for the project version (the action's "No log entry found for version X")
87
+
88
+ Not covered: `version_scheme: pep440`. Note the action only validates when `validation_level` is `warn` or `error` (default `none`).
89
+
90
+ ## License
91
+
92
+ [MIT](LICENSE)
@@ -0,0 +1,65 @@
1
+ [project]
2
+ name = "keepmeachangelog"
3
+ version = "0.1.0"
4
+ description = "Linter for CHANGELOG files following Keep a Changelog 1.1.0"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ keywords = ["changelog", "keep-a-changelog", "lint", "linter", "pre-commit", "semver"]
9
+ classifiers = [
10
+ "Development Status :: 4 - Beta",
11
+ "Environment :: Console",
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3",
14
+ "Topic :: Software Development :: Quality Assurance",
15
+ ]
16
+ requires-python = ">=3.11"
17
+ dependencies = []
18
+
19
+ [project.urls]
20
+ Homepage = "https://github.com/dcotecnologia/keepmeachangelog-lint"
21
+ Repository = "https://github.com/dcotecnologia/keepmeachangelog-lint"
22
+ Changelog = "https://github.com/dcotecnologia/keepmeachangelog-lint/blob/main/CHANGELOG.md"
23
+
24
+ [project.scripts]
25
+ keepmeachangelog = "keepmeachangelog.cli:main"
26
+
27
+ [build-system]
28
+ requires = ["hatchling"]
29
+ build-backend = "hatchling.build"
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["src/keepmeachangelog"]
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "pyright>=1.1.414",
37
+ ]
38
+ test = [
39
+ "pytest>=9.2.0",
40
+ "pytest-cov>=7.1.0",
41
+ ]
42
+
43
+ [tool.pytest.ini_options]
44
+ log_cli = false
45
+ log_cli_level = "WARNING"
46
+ minversion = "9.0"
47
+ testpaths = ["tests"]
48
+ pythonpath = ["src"]
49
+ addopts = "--import-mode=importlib -s --cov=. --log-level=WARN --strict-markers --tb=short --cov-report=term-missing --cov-report=xml --cov-fail-under=100 --cov-config=pyproject.toml"
50
+
51
+ [tool.coverage.run]
52
+ branch = true
53
+ source = ["src"]
54
+ omit = ["**/__init__.py", "tests/*"]
55
+
56
+ [tool.coverage.report]
57
+ show_missing = true
58
+ skip_covered = false
59
+ precision = 2
60
+
61
+ [tool.pyright]
62
+ pythonVersion = "3.11"
63
+ include = ["src", "tests"]
64
+ extraPaths = ["src"]
65
+ typeCheckingMode = "standard"