Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Sep 3, 2025

Summary by CodeRabbit

  • New Features
    • More robust handling of .env values: values with whitespace or special characters are now automatically quoted; escaping of backslashes and quotes preserved.
  • Bug Fixes
    • Prevents misinterpretation of .env entries with characters like #, $, !, ;, &, |, >, <, *, ?, (, ), {, }, [, ], `, ', ".
    • Ensures common emails and URLs remain unquoted for readability.
  • Tests
    • Expanded unit tests covering whitespace, special characters, combined scenarios, and edge cases to validate the updated formatting behavior.

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Walkthrough

The Env utility’s formatValueForDotenv now quotes values containing whitespace or specified special characters. Escaping of backslashes and double quotes is retained. Unit tests were expanded and reorganized to cover emails, URLs, shell-special characters, combinations with whitespace, and edge cases. No public interfaces changed.

Changes

Cohort / File(s) Summary
Env formatting logic
.vortex/installer/src/Utils/Env.php
Broadened quoting criteria in formatValueForDotenv to include whitespace and a set of special characters; preserved escaping of backslashes and double quotes; unchanged method signature.
Unit tests for Env formatting
.vortex/installer/tests/Unit/EnvTest.php
Reworked and expanded tests covering non-quoted cases (emails, URLs), quoted cases for shell-special chars, combinations with whitespace, and edge cases (e.g., equals sign not triggering quotes).

Sequence Diagram(s)

sequenceDiagram
  participant C as Caller
  participant E as Env::formatValueForDotenv

  C->>E: formatValueForDotenv(value)
  alt contains whitespace or special chars
    note over E: Special chars include #, $, !, ;, &, |, >, <, *, ?, (, ), {, }, [, ], `, ', "
    E->>E: Escape backslashes and double quotes
    E-->>C: Return "escaped_value"
  else no matches
    E-->>C: Return value unchanged
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit taps keys with a whiskered grin,
Quotes now catch where specials begin.
URLs hop free, emails glide through,
Backslashes behave, and doubles do too.
Tests multiply like carrots in spring—
Dotenv’s garden, neat as a ring. 🥕✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 phpcs (3.7.2)
.vortex/installer/src/Utils/Env.php

ERROR: Referenced sniff "Drupal" does not exist

Run "phpcs --help" for usage information

.vortex/installer/tests/Unit/EnvTest.php

ERROR: Referenced sniff "Drupal" does not exist

Run "phpcs --help" for usage information


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4819672 and e749194.

📒 Files selected for processing (2)
  • .vortex/installer/src/Utils/Env.php (1 hunks)
  • .vortex/installer/tests/Unit/EnvTest.php (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: build (0)
  • GitHub Check: build (1)
  • GitHub Check: vortex-test-workflow (0)
  • GitHub Check: vortex-test-deployment (1)
  • GitHub Check: vortex-test-workflow (4)
  • GitHub Check: vortex-test-workflow (2)
  • GitHub Check: vortex-test-workflow (3)
  • GitHub Check: vortex-test-workflow (1)
  • GitHub Check: vortex-test-deployment (0)
  • GitHub Check: vortex-test-common
  • GitHub Check: vortex-test-installer (8.3)
  • GitHub Check: vortex-test-installer (8.2)
  • GitHub Check: vortex-test-installer (8.4)
  • GitHub Check: vortex-test-docs
🔇 Additional comments (5)
.vortex/installer/src/Utils/Env.php (1)

210-215: Quoting rule expansion looks correct

The character class covers whitespace and a comprehensive set of shell metacharacters; escaping of backslash and double quotes is handled properly before wrapping in double quotes.

.vortex/installer/tests/Unit/EnvTest.php (4)

169-181: Good coverage for non-quoted safe values

Emails/URLs and typical tokens remain unquoted as intended. This aligns with the new formatting rules.


193-210: Thorough special-character cases

Solid set covering comment markers, pipes, redirection, globbing, grouping, and quotes. Nice inclusion of escaping expectations for double quotes.


211-216: Combined scenarios are well captured

Whitespace + metacharacter combinations validate the broadened quoting behavior.


217-221: I've provided scripts to locate writeValueDotenv’s implementation and usages to verify whether it relies on preg_replace (which would interpret $1) or preg_replace_callback (which would not). Execute these to determine if the backreference test is necessary.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/fix-installer-double-quotes

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot temporarily deployed to commit September 3, 2025 20:44 Inactive
@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.69%. Comparing base (4819672) to head (e749194).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1972   +/-   ##
========================================
  Coverage    77.69%   77.69%           
========================================
  Files           90       90           
  Lines         5550     5550           
  Branches        44       44           
========================================
  Hits          4312     4312           
  Misses        1238     1238           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk merged commit e5786a0 into develop Sep 3, 2025
31 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/fix-installer-double-quotes branch September 3, 2025 21:27
@github-project-automation github-project-automation bot moved this from BACKLOG to Release queue in Vortex Sep 3, 2025
@AlexSkrypnyk AlexSkrypnyk moved this from Release queue to Released in 25.8.0 in Vortex Sep 5, 2025
@AlexSkrypnyk AlexSkrypnyk added this to the 25.8.0 milestone Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants