fix(configfile): skip comment lines correctly #930
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the config file parser to correctly skip comment lines and improves report output consistency.
Changes
1.
src/ConfigFile.pyReadConfigLine()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.patternstoft_patternsinReadFileType()for clarity.2.
src/reports.pyIsUnknown()to check for'(Not Found)'instead of'NotFound'to match actual data format.printstatements withWrite()calls inReportByFileType()for consistent output handling.total_by_hackerdictionary.3.
gitdm.ps1-ccommands for cleaner PowerShell syntax.Files Changed
src/ConfigFile.pysrc/reports.pygitdm.ps1Impact
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 ofprintinReportByFileType()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.ps1reduces code complexity and removes heredoc syntax that can be problematic in certain PowerShell environments.