mirror of
https://github.com/Heretek-AI/heretek-control-core.git
synced 2026-10-12 02:03:55 +00:00
Addresses the first SonarCloud analysis on PR #1 (128 new-code findings). Genuine issues are fixed in code; convention/style rules (camelCase naming php:S100/S101/S116, too-many-returns php:S1142) and the standalone test harnesses are handled via the SonarCloud profile + sonar-project.properties because snake_case + WP_Error guards are the WordPress conventions here. Security: - connector: transfer ids are now whitelisted ([A-Za-z0-9_-]{8,64}) and rejected before any path use; the residual S2083 path-build findings (the resume-keyed store must use the id) carry NOSONAR + rationale after the HMAC gate + strict validation. Complexity (php:S3776) - extracted helpers so no function sits far over the raised threshold: - connector: search_replace -> data_tables/text_columns/rewrite_rows; restore_archive -> restore_db; import -> run_dump_statement. - migrate-abilities: execute_migrate -> push_archive_packets/packet_error/ push_finalize/poll_job. - db-importer: run_statement helper (per-statement execution shared with the trailing no-';' fragment). - restore-engine: restore() -> restore_database(); append_log() dropped its unused $filename parameter. - char-state-machine extractors (extract_statement x2) carry NOSONAR + rationale. Other: - packager: .emcp extension -> const EXT; add_files split into file_iterator/ dir_is_skipped/zip_relative_name. - db-exporter: removed unused $col_ph. - migrate module: single-arg nonces (WP default _wpnonce, matching the view), page-URL helper, dropped unused $back params. - page-migrate view: single-arg wp_nonce_field(). - restore-engine + serialized-search-replace: tabs -> spaces. - sonar-project.properties: exclude tests/** + vendor/** (test harnesses mirror WP core function names by design). Tests: tests/test-migrate-packager.php 8 suites still green; php -l clean. Co-Authored-By: Claude <[email protected]>