Skip to content

Introduction of Context Class for Plugin Architecture #1

@rafaelherik

Description

@rafaelherik

Overview

Implement a Context class to establish a foundation for future plugin capabilities in the Terraform plan analyzer. This architectural change improves the system's extensibility and provides a centralized way to manage configuration, logging, and shared state.

Technical Details

The Context class serves as a dependency injection container and configuration manager, providing:

  1. Centralized Configuration Management

    • Handles loading and merging of default and custom rule configurations
    • Manages sensitive pattern definitions and risk rules
    • Provides a unified interface for configuration access
  2. Logging Infrastructure

    • Configurable logging levels (DEBUG/INFO)
    • Consistent logging format across the application
    • Centralized logging configuration
  3. Plugin Architecture Foundation

    • Acts as a shared state container between components
    • Provides a standardized interface for future plugin interactions
    • Enables dependency injection for better testability

Implementation Benefits

  • Loose Coupling: Components can now communicate through the context rather than direct dependencies
  • Improved Testability: Easier to mock dependencies and configurations in tests
  • Configuration Flexibility: Supports both default and custom configurations with clean merge logic
  • Future Extensibility: Provides a clean interface for plugin developers to access and extend functionality

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions