Status: The file is currently 2,146 lines long, significantly exceeding the 1,000-line maintainability threshold. It has become a "God Object" that handles everything from low-level byte-copying and regex-based minification to high-level site orchestration.
- High Orchestration-to-Implementation Ratio: The
SiteGeneratorclass is deeply coupled with the "how" of every task. For example, it doesn't just ask to "minify assets"; it knows exactly which library to call and how to handle specific filename collisions for both CSS and JS separately. - Repetitive Page Generation Patterns: Almost every
_generate_X_pagemethod (over 10 in total) follows an identical 5-step pattern:- Fetch global context.
- Inject sidebar pages.
- Resolve an absolute output path.
- Compute and inject a canonical URL.
- Render and write to disk.
- Observation: This boilerplate can be abstracted into a single internal rendering pipeline.
- Fragmented Path & URL Logic: Logic for calculating URLs and file system paths is scattered. Some parts use dedicated helpers like
_get_configured_url, while others manually join paths or uselstrip("/")repeatedly. - Redundant Minification Logic: The logic for minifying CSS and JS is nearly identical but implemented in separate methods (
_write_minified_cssvs_write_minified_js), leading to duplicated error handling and file system checks.