Skip to content

Add placeholder validation to make-mo/make-php/make-json#475

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/validate-strings-placeholders
Draft

Add placeholder validation to make-mo/make-php/make-json#475
Copilot wants to merge 7 commits intomainfrom
copilot/validate-strings-placeholders

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Implementation Plan

  • Create a new StringAuditTrait.php trait to hold reusable validation logic
    • Extract regex constants from MakePotCommand
    • Extract the core audit_strings validation logic
    • Make validation logic flexible (not dependent on project_type/get_file_headers)
  • Update MakePotCommand to use the new trait
    • Add use StringAuditTrait statement
    • Update audit_strings to call trait method
    • Keep regex constants in class for backward compatibility
  • Update MakeMoCommand to use the new trait
    • Add use StringAuditTrait statement
    • Call perform_string_audit after loading translations
  • Update MakePhpCommand to use the new trait
    • Add use StringAuditTrait statement
    • Call perform_string_audit after loading translations
  • Update MakeJsonCommand to use the new trait
    • Add use StringAuditTrait statement
    • Call perform_string_audit after loading translations
  • Add tests for the new validation behavior
    • Test validation warnings in make-mo
    • Test validation warnings in make-php
    • Test validation warnings in make-json
  • Run linting and existing tests to ensure no regressions
  • Security scan with CodeQL
  • Final code review
    • Address code review feedback
    • Fix strpos() warning caused by incorrect namespace
    • Update existing tests to expect validation warnings
    • Fix failing tests by using "try" instead of "run"
Original prompt

This section details on the original issue you should resolve

<issue_title>Validate strings with placeholders in make-mo/make-php</issue_title>
<issue_description>This is a follow-up to #427

Ideally we add some validation logic to make-mo and make-php as well. We already do some validation in make-pot (see audit_strings() method, which we could extract into a reusable trait.

Maybe make-json too?

Prevents you from generating translation files with incorrect placeholders in them.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 14, 2026 22:38
…commands

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add validation for placeholders in make-mo and make-php Add placeholder validation to make-mo/make-php/make-json Feb 14, 2026
Copilot AI requested a review from swissspidy February 14, 2026 22:45
@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

Copilot AI and others added 2 commits February 15, 2026 17:22
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 15, 2026

@copilot 3 failing tests:

...

Fixed in commits 2a662c6 and 05a4e51. The tests were failing because When I run treats any STDERR output (including warnings) as a potential failure. Changed the three failing test scenarios to use When I try instead, which allows warnings to STDERR. Also updated test 1 to explicitly check that warnings are present in STDERR with And STDERR should contain: "Warning:".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate strings with placeholders in make-mo/make-php

2 participants