-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
/Vagrantfile | ||
/.vagrant | ||
/node_modules | ||
.phpunit.result.cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,3 @@ deploy: | |
repo: CouscousPHP/Couscous | ||
tags: true | ||
php: '7.1' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,28 +16,23 @@ | |
], | ||
"require": { | ||
"php": ">=7.1", | ||
"symfony/console": "~3.0|~4.0|~5.0", | ||
"symfony/filesystem": "~3.0|~4.0|~5.0", | ||
"symfony/finder": "~3.0|~4.0|~5.0", | ||
"symfony/process": "~3.0|~4.0|~5.0", | ||
"symfony/yaml": "~3.0|~4.0|~5.0", | ||
"twig/twig": "~1.10", | ||
"erusev/parsedown": "~1.7.4", | ||
"erusev/parsedown-extra": "~0.8", | ||
"phine/phar": "~1.0", | ||
"mnapoli/front-yaml": "~1.5", | ||
"php-di/php-di": "^5.2.1", | ||
"psr/log": "~1.0", | ||
"symfony/console": "^3.0|^4.0|^5.0", | ||
"symfony/filesystem": "^3.0|^4.0|^5.0", | ||
"symfony/finder": "^3.0|^4.0|^5.0", | ||
"symfony/process": "^3.0|^4.0|^5.0", | ||
"symfony/yaml": "^3.0|^4.0|^5.0", | ||
"twig/twig": "^1.10", | ||
"erusev/parsedown": "^1.7", | ||
"erusev/parsedown-extra": "^0.8", | ||
"phine/phar": "^1.0", | ||
"mnapoli/front-yaml": "^1.5", | ||
"php-di/php-di": "^5.2", | ||
"psr/log": "^1.0", | ||
"padraic/phar-updater": "^1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~7.5", | ||
"phpunit/phpunit": "^7.5|^8.5|^9.3", | ||
"squizlabs/php_codesniffer": "^3.3", | ||
"vimeo/psalm": "^3.16" | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.1.3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Because some tests don't have the |
||
bootstrap="./vendor/autoload.php"> | ||
|
||
<testsuites> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Removing it everywhere instead then. |
||
protected function configure(): void | ||
{ | ||
$this | ||
->setName('clear') | ||
->setDescription('Clear all files generated by Couscous'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$dir = getcwd().'/.couscous'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,7 +220,7 @@ private function startLivereload( | |
|
||
private function isFound(string $executablePath): bool | ||
{ | ||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { | ||
if (stripos(PHP_OS, 'WIN') === 0) { | ||
$folders = explode(';', (string) getenv('PATH')); | ||
} else { | ||
$folders = explode(':', (string) getenv('PATH')); | ||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. It's a suggestion from PHP Inspections EA:
Please tell me if you really want to remove them, I will do it. |
||
return substr($file, strlen($sourceDirectory) + 1); | ||
}, $files); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Is it really a behavior change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I added them I used 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
|
||
$isPullRequest = (int) getenv('TRAVIS_PULL_REQUEST') > 0 ? true : false; | ||
$isPullRequest = (int) getenv('TRAVIS_PULL_REQUEST') > 0; | ||
|
||
if ($isPullRequest) { | ||
$output->writeln('<comment>[NOT DEPLOYED] Not deploying Couscous for pull requests</comment>'); | ||
|
||
return 0; | ||
return 1; | ||
} | ||
|
||
// getting current php version to only deploy once | ||
$currentPhpVersion = getenv('TRAVIS_PHP_VERSION'); | ||
if ($input->getOption('php-version') != $currentPhpVersion) { | ||
if ($input->getOption('php-version') !== $currentPhpVersion) { | ||
$output->writeln('<comment>This version of the documentation is already deployed</comment>'); | ||
|
||
return 0; | ||
return 1; | ||
} | ||
|
||
// set git user data | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 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 commentThe 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 commentThe 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. |
||
return !(ctype_space($changes) || $changes = ''); | ||
} | ||
|
||
|
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.