Skip to content

Commit 8bad089

Browse files
author
CoderDeltaLAN
committed
chore: initial commit
0 parents  commit 8bad089

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# commit-guardian

pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[tool.poetry]
2+
name = "commit-guardian"
3+
version = "0.1.0"
4+
description = "CLI to enforce commit hygiene, SPDX headers & LICENSE presence (Always-Green CI, MIT)."
5+
authors = ["CoderDeltaLAN <[email protected]>"]
6+
license = "MIT"
7+
readme = "README.md"
8+
packages = [{include = "commit_guardian", from = "src"}]
9+
10+
[tool.poetry.dependencies]
11+
python = "^3.11"
12+
click = "^8.1"
13+
14+
[tool.poetry.group.dev.dependencies]
15+
pytest = "^8.0"
16+
mypy = "^1.7"
17+
ruff = "^0.6"
18+
black = "^24.10"
19+
20+
[tool.poetry.scripts]
21+
commit-guardian = "commit_guardian.cli:main"
22+
23+
[tool.ruff]
24+
line-length = 100
25+
26+
[tool.black]
27+
line-length = 100
28+
29+
[tool.mypy]
30+
python_version = "3.11"
31+
warn_unused_ignores = true
32+
warn_redundant_casts = true
33+
disallow_untyped_defs = true

src/commit_guardian/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__all__ = ["ping", "__version__"]
2+
__version__ = "0.1.0"
3+
4+
def ping() -> str:
5+
return "pong"

src/commit_guardian/cli.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from __future__ import annotations
2+
import sys
3+
import click
4+
from . import __version__, ping
5+
6+
@click.command()
7+
@click.option("--version", is_flag=True, help="Show version and exit.")
8+
def main(version: bool) -> None:
9+
if version:
10+
click.echo(__version__)
11+
raise SystemExit(0)
12+
click.echo(ping())
13+
raise SystemExit(0)
14+
15+
if __name__ == "__main__":
16+
main()

tests/test_sanity.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import commit_guardian as cg
2+
3+
def test_ping() -> None:
4+
assert cg.ping() == "pong"

0 commit comments

Comments
 (0)