diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index bc46299..2c962ae 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: GitHub Discussions - url: https://github.com/jacksonferguson/git-pulsar/discussions + url: https://github.com/jacksonfergusondev/git-pulsar/discussions about: Please ask questions and discuss ideas here before opening an issue. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d495eb1..2d04e27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: # 2. Python-specific toolchain - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.11 + rev: v0.15.4 hooks: - id: ruff-format - id: ruff @@ -25,7 +25,7 @@ repos: # 3. Markdown linting - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.47.0 + rev: v0.48.0 hooks: - id: markdownlint args: ["--fix"] # Automatically resolves formatting deviations diff --git a/pyproject.toml b/pyproject.toml index 9699050..0929ab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,18 +69,27 @@ exclude = [ # T20: Print (prevents accidentally leaving print() in CLI tools) # PT: Pytest style # C4: Comprehensions (better list/dict comp usage) -select = ["E", "F", "I", "B", "UP", "SIM", "T20", "PT", "C4"] -ignore = ["E501"] # Line length handled by formatter +# D: Docstrings +select = ["E", "F", "I", "B", "UP", "SIM", "T20", "PT", "C4", "D"] +ignore = [ + "E501", + "D100", # Missing docstring in public module + "D104", # Missing docstring in public package + "D107", # Missing docstring in __init__ +] # Allow ignored variables (e.g. for unpacking) dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +[tool.ruff.lint.pydocstyle] +convention = "google" + [tool.ruff.lint.isort] known-first-party = ["git_pulsar"] section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] [tool.ruff.lint.per-file-ignores] -"tests/*.py" = ["T201"] +"tests/*.py" = ["T201", "D"] [tool.ruff.format] quote-style = "double" @@ -90,6 +99,9 @@ line-ending = "auto" [tool.mypy] python_version = "3.12" +pretty = true +show_error_codes = true +show_error_context = true warn_return_any = true warn_unused_configs = true check_untyped_defs = true diff --git a/src/git_pulsar/cli.py b/src/git_pulsar/cli.py index 067f2ff..c0d72f1 100644 --- a/src/git_pulsar/cli.py +++ b/src/git_pulsar/cli.py @@ -1,5 +1,6 @@ import argparse import datetime +import importlib.metadata import logging import os import subprocess @@ -60,8 +61,7 @@ def _get_ref(repo: GitRepo) -> str: def _analyze_logs(seconds: int = 86400) -> list[str]: - """ - Scans the daemon log for error messages that occurred within a recent time window. + """Scans the daemon log for error messages that occurred within a recent time window. Args: seconds (int, optional): The number of seconds to look back. Defaults to 86400 (24h). @@ -499,8 +499,8 @@ def _check_git_hooks(repo_path: Path) -> list[str]: def run_doctor() -> None: - """ - Diagnoses system health, cleans the registry, and checks connectivity and logs. + """Diagnoses system health, cleans the registry, and checks connectivity and logs. + Includes an interactive resolution queue for safe auto-fixes. """ console.print("[bold]Pulsar Doctor[/bold]\n") @@ -1117,6 +1117,14 @@ def main() -> None: help=argparse.SUPPRESS, ) + # Add the version flag here + parser.add_argument( + "--version", + action="version", + version=f"%(prog)s {importlib.metadata.version('git-pulsar')}", + help="Show the application version and exit.", + ) + # Global flags subparsers = parser.add_subparsers( diff --git a/src/git_pulsar/git_wrapper.py b/src/git_pulsar/git_wrapper.py index 5474037..869ab7c 100644 --- a/src/git_pulsar/git_wrapper.py +++ b/src/git_pulsar/git_wrapper.py @@ -132,10 +132,7 @@ def commit(self, message: str, no_verify: bool = False) -> None: self._run(cmd, capture=False) def add_all(self) -> None: - """ - Stages all changes (modified, deleted, and untracked files) - in the working directory. - """ + """Stages all changes (modified, deleted, and untracked files) in the working directory.""" self._run(["add", "."], capture=False) def merge_squash(self, *branches: str) -> None: diff --git a/src/git_pulsar/ops.py b/src/git_pulsar/ops.py index b14ae2f..6cb87d6 100644 --- a/src/git_pulsar/ops.py +++ b/src/git_pulsar/ops.py @@ -22,8 +22,7 @@ def get_backup_ref(branch: str) -> str: - """ - Constructs the fully qualified backup reference for the current machine and branch. + """Constructs the fully qualified backup reference for the current machine and branch. Args: branch (str): The name of the branch to back up.