- Use nullable reference types consistently. Declare properties as nullable (
string?) when they can be null, or ensure non-nullable properties are initialized. - Follow existing namespace patterns:
CodeQLToolkit.Features.*,CodeQLToolkit.Shared.*,CodeQLToolkit.Core.* - Use the existing logging pattern:
Log<ClassName>.G().LogInformation()for logging - Prefer
Path.Combine()for file path construction instead of string concatenation
- Feature Pattern: Features are organized under
CodeQLToolkit.Featureswith main registration classes likeQueryFeatureMain,TestFeatureMain, etc. - Command Pattern: Use
System.CommandLinefor CLI command implementation with proper option handling - Template Pattern: Lifecycle targets inherit from
BaseLifecycleTargetand implement specific automation workflows - Dependency Injection: Use constructor injection and register services appropriately
BaseLifecycleTarget: Abstract base for lifecycle automation targets (Actions, Local, etc.)ILifecycleTarget: Interface for lifecycle operations withRun()methodTemplateUtil: Use for rendering Liquid templates withTemplateFromFile()andRawTemplateFromFile()QLTConfig: Configuration management with JSON serialization using Newtonsoft.JsonQuery: Utility class for managing CodeQL query file paths and structure
- Keep automation-specific logic in separate targets under
Lifecycle/Targets/Actions/,Lifecycle/Targets/Local/ - Templates should be organized by feature:
Templates/Query/,Templates/Test/,Templates/Bundle/ - Shared utilities go in
CodeQLToolkit.Shared/Utils/
- Use proper exception handling and meaningful error messages
- Log important operations and errors using the established logging framework
- Validate file paths and directory existence before operations
- Follow the existing test structure in
test/CodeQLToolkit.*.Tests/ - Use NUnit testing framework consistently with the existing patterns
- Consider using constraint model:
Assert.That(actual, Is.EqualTo(expected))instead of classic model