Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI-1181: [pull:code] disable scripts for build branches #1614

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

danepowell
Copy link
Contributor

@danepowell danepowell commented Oct 25, 2023

Motivation

For certain applications and environments, composer install can fail when composer dependencies are already installed

Proposed changes

Don't run composer install if dependencies are already installed; i.e., for build branches.

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7ccc649) 91.81% compared to head (7d62f10) 91.83%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1614      +/-   ##
============================================
+ Coverage     91.81%   91.83%   +0.02%     
- Complexity     1815     1816       +1     
============================================
  Files           124      124              
  Lines          6498     6505       +7     
============================================
+ Hits           5966     5974       +8     
+ Misses          532      531       -1     
Files Coverage Δ
src/Command/Pull/PullCommandBase.php 91.90% <100.00%> (+0.32%) ⬆️

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

Copy link

@kaynenh kaynenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I get the logic here but best if you get another approval.

$this->checklist->completePreviousItem();
if (!file_exists(Path::join($this->dir, 'composer.json'))) {
$this->logger->notice('composer.json file not found. Skipping composer install.');
return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negative exists logic here seems to make sense, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to do any validation at the start of the method, hence the negative logic. I'm open to alternatives.

}
$this->checklist->addItem("Installing Composer dependencies");
$this->composerInstall($outputCallback);
$this->checklist->completePreviousItem();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the mutation tests are catching something here or if they just need to be updated. It seems it's the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to idiosyncrasies with how the Symfony Command Tester class handles output, our test cases can't verify that these checklist items appear in the command output. Hence the escaped mutant. But it's not caused by this PR, so we can ignore it.

@danepowell
Copy link
Contributor Author

This is ready for review (we even increased test coverage and MSI! 😮 )

@danepowell danepowell merged commit 229162d into acquia:main Oct 26, 2023
12 checks passed
@danepowell danepowell deleted the cli1181 branch September 20, 2024 15:51
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.

3 participants