Skip to content

Fix mypy configuration and tighten typing coverage - #2

Merged
steven-cutting merged 1 commit into
codex/bootstrap-decree-repo-with-initial-filesfrom
codex/fix-errors-from-pre-commit-and-mypy
Oct 7, 2025
Merged

steven-cutting merged 1 commit into
codex/bootstrap-decree-repo-with-initial-filesfrom
codex/fix-errors-from-pre-commit-and-mypy

Conversation

@steven-cutting

Copy link
Copy Markdown
Owner

Summary

  • fix the mypy exclude regex and satisfy strict typing in utilities and tests
  • ensure ADR creation keeps a consistent resolved date and mark helper as NoReturn
  • add explicit fixture and test annotations required by the strict mypy configuration

Testing

  • uv run mypy src tests
  • uv run pytest
  • pre-commit run --all-files (fails: markdownlint nodeenv bootstrap requires external network and exits with an SSL certificate error)

https://chatgpt.com/codex/tasks/task_e_68e4720714108326b7f80d65e09cbc42

@steven-cutting

Copy link
Copy Markdown
Owner Author

@codex

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes mypy configuration and tightens typing coverage to ensure strict type checking across the codebase. It addresses configuration issues and adds missing type annotations for better type safety.

  • Fixed mypy exclude regex configuration to be properly formatted
  • Added explicit return type annotations to test functions and fixtures
  • Improved type safety in utility functions with better type annotations

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mypy.ini Simplified exclude regex pattern for third-party directories
tests/test_slugify.py Added return type annotation to test function
tests/test_new_list_toc.py Added return type annotation to test function
tests/test_date_envs.py Added pytest import and type annotations for test functions
tests/test_cli_init.py Added return type annotation to test function
tests/conftest.py Added Iterator import and return type annotation for fixture
src/decree/utils.py Improved type annotations and variable handling in resolve_date
src/decree/core.py Added NoReturn type and improved date handling consistency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/decree/utils.py
Comment on lines +18 to +21
actual_env: Mapping[str, str] = os.environ if env is None else env
if d := actual_env.get("ADR_DATE"):
return d
tz = env.get("DECREE_TZ", "UTC")
tz = actual_env.get("DECREE_TZ", "UTC")

Copilot AI Oct 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The variable name actual_env is verbose and doesn't add clarity. Consider using a shorter name like env_dict or simply reassigning to env.

Copilot uses AI. Check for mistakes.
Comment thread src/decree/core.py
slug = slugify(title)
path = self.dir / f"{number:04d}-{slug}.md"
tpl = template.read_text(encoding="utf-8") if template else DEFAULT_TEMPLATE
record_date = date or resolve_date()

Copilot AI Oct 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable record_date is computed but then used inconsistently. The AdrRecord constructor uses record_date while the template formatting also uses record_date, but the logic could be clearer by computing this value once at the beginning of the method.

Copilot uses AI. Check for mistakes.
Comment thread src/decree/core.py
title=title,
status=status.value,
date=(date or resolve_date()),
date=record_date,

Copilot AI Oct 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable record_date is computed but then used inconsistently. The AdrRecord constructor uses record_date while the template formatting also uses record_date, but the logic could be clearer by computing this value once at the beginning of the method.

Copilot uses AI. Check for mistakes.
Comment thread src/decree/core.py
path.write_text(content, encoding="utf-8", newline="\n")
return AdrRecord(
number=number, slug=slug, title=title, status=status, date=resolve_date(), path=path
number=number, slug=slug, title=title, status=status, date=record_date, path=path

Copilot AI Oct 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable record_date is computed but then used inconsistently. The AdrRecord constructor uses record_date while the template formatting also uses record_date, but the logic could be clearer by computing this value once at the beginning of the method.

Copilot uses AI. Check for mistakes.
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@steven-cutting
steven-cutting merged commit f5de698 into codex/bootstrap-decree-repo-with-initial-files Oct 7, 2025
0 of 6 checks passed
@steven-cutting
steven-cutting deleted the codex/fix-errors-from-pre-commit-and-mypy branch October 7, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants