Add comprehensive remediation reporting functionality (Issue #34)#173
Merged
Add comprehensive remediation reporting functionality (Issue #34)#173
Conversation
This commit implements a complete reporting system for aggregating and analyzing remediation configurations from multiple network devices. Key Features: - RemediationReporter class for merging multiple device remediations - Instance tracking to count how many devices need each change - Tag-based filtering and categorization - Query methods for impact analysis and pattern matching - Export to multiple formats (JSON, CSV, Markdown, Text) - Comprehensive statistical analysis tools Components Added: - hier_config/reporting.py: Main RemediationReporter class - hier_config/models.py: Added ChangeDetail and ReportSummary models - tests/test_reporting.py: 28 comprehensive test cases - docs/remediation-reporting.md: Complete documentation with examples - hier_config/__init__.py: Export new public API - mkdocs.yml: Add documentation to site navigation Core Improvement: - Modified hier_config/base.py add_shallow_copy_of() to properly handle duplicate children during merge operations by using return_if_present=True when merged=True. This enables correct instance tracking across devices. Closes #34
- Add type annotations for device_ids and path_parts variables - Fix fixture return types to use tuple[HConfig, str] - Fix test function parameter types - Add import of operator module for itemgetter usage - Format code with ruff - Combine nested if statements - Use operator.itemgetter instead of lambdas - Use ternary operator for label assignment - Use r-string for docstring with backslashes - Use lines.extend for better performance - Add noqa comments for private attribute access
- Fix pyright type inference issues by using isinstance() for type narrowing - Add explicit type annotations for tuple and dict returns - Convert if/else blocks to ternary expressions per pylint suggestions - Fix export_all() to use proper file extensions (.md instead of .markdown, .txt instead of .text) - All linters now pass: ruff, mypy, pyright - All 486 tests pass with 95.45% coverage
- Disable redefined-outer-name for pytest fixtures (standard pytest pattern) - Disable too-many-try-statements for test cleanup code - All linters now pass with no warnings (10/10 pylint score)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit implements a complete reporting system for aggregating and analyzing remediation configurations from multiple network devices.
Key Features:
Components Added:
Core Improvement:
Closes #34