Skip to content

Add type annotations to core modules#223

Merged
shenxianpeng merged 4 commits into
mainfrom
fix/type-annotations
May 25, 2026
Merged

Add type annotations to core modules#223
shenxianpeng merged 4 commits into
mainfrom
fix/type-annotations

Conversation

@shenxianpeng
Copy link
Copy Markdown
Owner

@shenxianpeng shenxianpeng commented May 16, 2026

Summary

Adds type hints to public API methods across all core modules.

Changes

__init__.py

  • load_config(): parameter and return type
  • Global variables: exectime_internal, exectime_external, ON_LINUX, WEEKDAYS, _config

main.py

report_creator.py

  • ReportCreator: create
  • HTMLReportCreator: create, create_*_html(), get_ai_summary_html(), _render_chartjs()
  • Module helpers: html_header, html_linkify, get_keys_sorted_by_values, get_keys_sorted_by_value_key
  • Also fixes dictd parameter naming in get_keys_sorted_by_values

utils.py

  • All utility functions: count_lines_in_text, filter_lines_by_pattern, get_version, get_git_version, get_pipe_output, get_commit_range, get_excluded_extensions, should_exclude_file, get_num_of_lines_in_blob, get_num_of_files_from_rev, get_stat_summary_counts, get_log_range

143 tests pass.

Closes #211, #215


📚 Documentation preview 📚: https://gitstats--223.org.readthedocs.build/

Adds type hints to public API methods across all core modules:
- __init__.py: load_config(), global variables
- main.py: DataCollector and GitDataCollector methods
- report_creator.py: HTMLReportCreator methods and helpers
- utils.py: All utility functions

Also fixes parameter naming:
- get_keys_sorted_by_values: dict -> d (no longer shadows builtin)
- DataCollector.collect: dir -> repo_dir (no longer shadows builtin)

Closes #215, #211
@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for shenxianpeng-gitstats ready!

Name Link
🔨 Latest commit 8bef8f0
🔍 Latest deploy log https://app.netlify.com/projects/shenxianpeng-gitstats/deploys/6a0d3b0006ce1c0008f681b9
😎 Deploy Preview https://deploy-preview-223--shenxianpeng-gitstats.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@shenxianpeng shenxianpeng added the enhancement New feature or request label May 20, 2026
@shenxianpeng shenxianpeng changed the title fix: add type annotations to core modules Add type annotations to core modules May 20, 2026
@sonarqubecloud
Copy link
Copy Markdown

@shenxianpeng shenxianpeng merged commit eda4efe into main May 25, 2026
26 checks passed
@shenxianpeng shenxianpeng deleted the fix/type-annotations branch May 25, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add type annotations to core modules

1 participant