-
-
Notifications
You must be signed in to change notification settings - Fork 107
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
More modernization #260
More modernization #260
Conversation
@@ -39,7 +39,7 @@ $builder->buildFromIterator( | |||
->files() | |||
->name('*.php') | |||
->name('*.pem*') | |||
->exclude(['Tests', 'tests', 'phpunit']) | |||
->exclude(['Tests', 'tests']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the PHAR needs phpunit/phpunit/src/Framework/Assert/Functions.php
, autoloaded by Composer in the latest PHPUnit.
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.1.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why locking the PHP version to 7.1.3, since all versions are tested in the CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config is problematic because it tells Composer the PHP version installed is PHP 7.1.3 (see https://getcomposer.org/doc/06-config.md#platform).
It means that, in the CI, when PHP 7.4 is used, Composer is actually installing packages for PHP 7.1.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the initial reason of why the platform was set to php 7.1, I only specified the bugfix version so I could install psalm.
If there isn't a concrete reason to specify the php version it's better to remove it indeed. That being said I don't think it's problematic that composer install dependencies targeting 7.1, as long as the dependencies themselves are tested against 7.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's problematic, because it means you cannot test Couscous against the latest dependencies.
For instance, Symfony 5 was not tested (PHP > 7.2), and, if tested, we could have seen it was failing because of the missing return codes in the commands.
@@ -5,7 +5,6 @@ | |||
convertWarningsToExceptions="true" | |||
beStrictAboutOutputDuringTests="true" | |||
beStrictAboutTestsThatDoNotTestAnything="true" | |||
forceCoversAnnotation="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because some tests don't have the @cover
annotation (and the latest PHPUnit doesn't like this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comments, the PR changes a lot of things in a single commit, so it's really hard to review and be confident
src/Application/Cli/ClearCommand.php
Outdated
@@ -29,13 +29,19 @@ public function __construct(Filesystem $filesystem) | |||
parent::__construct(); | |||
} | |||
|
|||
/** | |||
* {@inheritdoc} | |||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please revert these? (it's adding unnecessary noise)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Removing it everywhere instead then.
@@ -237,7 +237,7 @@ private function isFound(string $executablePath): bool | |||
|
|||
private function fileListToDisplay(array $files, string $sourceDirectory): string | |||
{ | |||
$files = array_map(function (string $file) use ($sourceDirectory): string { | |||
$files = array_map(static function (string $file) use ($sourceDirectory): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for these, they are not useful and add noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a suggestion from PHP Inspections EA:
[EA] This closure can be declared as static (better scoping; in some cases can improve performance).
Please tell me if you really want to remove them, I will do it.
@@ -93,23 +93,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
if ($travisBranch !== 'master') { | |||
$output->writeln('<comment>[NOT DEPLOYED] Deploying Couscous only for master branch</comment>'); | |||
|
|||
return 0; | |||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a behavior change, not sure we want that. Why change that? (same for the lines below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really a behavior change?
The return values have been added in the #259 PR.
Also it means the command has failed (EXIT_FAILURE
), isn't it better? (can be useful when chaining commands in Bash for instance).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I added them I used 0
as the output only contains comments and no errors (and because that's the default value set by Symfony).
As far as I understand how the CI is configured this exit code won't change the behaviour of the CI as the command is run on after_success
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, the comments look like errors, and that's why I changed the return codes, but I could be wrong.
@@ -61,11 +61,13 @@ public function getRemoteUrl(string $remote = 'origin'): string | |||
* Check if the git repository in the provided directory has any uncommitted changes | |||
* | |||
* @param string $directory A directory containing a git repository | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a CS fix to be coherent with the rest of the codebase (there is a new line before every @return
everywhere else).
* @return bool True if there are changes, false otherwise | ||
*/ | ||
public function hasUncommittedChanges(string $directory): bool | ||
{ | ||
$changes = $this->run($directory, "git diff-index --name-only HEAD"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also a CS fix to be coherent with the rest of the codebase.
It's a common CS (for instance in Symfony).
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.1.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry for that. I thought it was OK since it's mainly typehint in test files (and the tests are green). |
@@ -14,7 +14,7 @@ | |||
*/ | |||
class ValidateTemplateDirectory implements Step | |||
{ | |||
const DEFAULT_TEMPLATE_DIRECTORY = 'website'; | |||
public const DEFAULT_TEMPLATE_DIRECTORY = 'website'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this const public when the others are private ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because this const is also used here:
$templateDirectory = $project->sourceDirectory.'/'.ValidateTemplateDirectory::DEFAULT_TEMPLATE_DIRECTORY; |
Do you want me to revamp this PR? Maybe by doing small PRs instead? |
Hi, yes 馃槄 I'm sorry, reviewing PRs takes a lot of time across all the repositories, and this one is huge and not top priority so I have a lot of trouble saving time for this. Let's move forward and close this one, I don't think I'll be able to merge it. If you still want to, smaller (targeted) PRs would work better I think. Thanks for your efforts and patience! |
@Baptouuuu 馃檪