The sophos plugin relies heavily on global state and lacks a proper dependency injection mechanism:
- Excessive Global State: The plugin uses global configuration variables, leading to side effects and testing difficulties.
- Lack of DI: Handlers and SDK clients are instantiated directly within functions, making it impossible to inject mocks for testing.
Proposed Changes:
- Move towards an instance-based configuration manager.
- Implement dependency injection for the Sophos API client and other dependencies.
- Ensure all components receive their dependencies explicitly.