Skip to content

Conversation

@shbhmexe
Copy link
Contributor

@shbhmexe shbhmexe commented Dec 5, 2025

Summary

This PR fixes the config file parser to correctly skip comment lines and improves report output consistency.

Changes

1. src/ConfigFile.py

  • Fix comment handling: Changed ReadConfigLine() to recursively skip comment lines instead of returning an empty string. This ensures commented lines are fully ignored rather than being processed as blank lines.
  • Rename variable: Renamed patterns to ft_patterns in ReadFileType() for clarity.

2. src/reports.py

  • Fix unknown employer check: Updated IsUnknown() to check for '(Not Found)' instead of 'NotFound' to match actual data format.
  • Use Write() instead of print: Replaced raw print statements with Write() calls in ReportByFileType() for consistent output handling.
  • Remove unused variable: Removed unused total_by_hacker dictionary.

3. gitdm.ps1

  • Simplify Python detection: Replaced here-string Python version checks with inline -c commands for cleaner PowerShell syntax.

Files Changed

File Changes
src/ConfigFile.py +7 / -6
src/reports.py +8 / -9
gitdm.ps1 +2 / -8

Impact

  • Config parsing reliability: Comment lines in config files (e.g., gitdm.config, filetypes.cfg) will now be properly skipped without creating empty-line side effects. Previously, commented lines returned empty strings which could cause unexpected behavior in downstream parsing.

  • Report accuracy: The IsUnknown() fix ensures developers with unmapped employers are correctly identified as "unknown" — reports will now accurately reflect contributor affiliation status.

  • Output consistency: Using Write() instead of print in ReportByFileType() ensures all report output goes through the configured output stream, making it easier to redirect or capture programmatically.

  • Script maintainability: Simplified Python detection in gitdm.ps1 reduces code complexity and removes heredoc syntax that can be problematic in certain PowerShell environments.

Update config parser to ignore commented lines; adjust report logic; minor script cleanup; add PR details doc.

Changes (staged):

- PR_DETAILS.md: +58/-0 (add)

- gitdm.ps1: +2/-8 (modify)

- src/ConfigFile.py: +7/-6 (modify)

- src/reports.py: +8/-9 (modify)

Signed-off-by: shbhmexe <shubhushukla586@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant