tools: various updates

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/877/head
Varun Patil 2023-10-14 12:40:58 -07:00
parent d8c6266e53
commit e255c957f7
6 changed files with 42 additions and 42 deletions

View File

@ -43,4 +43,4 @@ jobs:
run: |
cd apps/memories
make install-tools
vendor/bin/psalm --no-cache --shepherd --stats --threads=4
vendor/bin/psalm --no-cache --shepherd --stats --threads=4 lib

View File

@ -15,21 +15,14 @@ declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->ignoreDotFiles(false)
->ignoreVCSIgnored(true)
->exclude('tests/Fixtures')
->in(__DIR__)
->append([
__DIR__.'/dev-tools/doc.php',
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
])
->in(__DIR__.'/lib')
;
$config = new PhpCsFixer\Config();
$config
->setUsingCache(true)
->setRiskyAllowed(true)
->setRules([
'@PHP71Migration' => false,
'@PHP71Migration:risky' => false,
'@PHPUnit75Migration:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
@ -39,21 +32,4 @@ $config
->setFinder($finder)
;
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
if (false !== getenv('FABBOT_IO')) {
try {
PhpCsFixer\FixerFactory::create()
->registerBuiltInFixers()
->registerCustomFixers($config->getCustomFixers())
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()))
;
} catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
$config->setRules([]);
} catch (UnexpectedValueException $e) {
$config->setRules([]);
} catch (InvalidArgumentException $e) {
$config->setRules([]);
}
}
return $config;
return $config;

19
.vscode/settings.json vendored
View File

@ -1,5 +1,4 @@
{
"intelephense.environment.phpVersion": "7.4.0",
"intelephense.stubs": [
"apache",
"bcmath",
@ -75,8 +74,19 @@
"zlib",
"imagick"
],
"intelephense.environment.phpVersion": "8.0.0",
"intelephense.environment.documentRoot": "${workspaceFolder}/../../",
"php-cs-fixer.allow-risky": true,
"psalm.disableAutoComplete": true,
"[php]": {
"editor.formatOnSave": false
"editor.defaultFormatter": "muuvmuuv.vscode-just-php-cs-fixer"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vetur.experimental.templateInterpolationService": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"files.trimTrailingWhitespace": false
@ -87,6 +97,5 @@
"**/patches": true
},
"git.alwaysSignOff": true,
"intelephense.environment.documentRoot": "/var/www/html",
"editor.formatOnSave": true
}
"editor.formatOnSave": true,
}

View File

@ -10,10 +10,10 @@ install-tools:
composer install
php-lint:
vendor/bin/php-cs-fixer fix lib
vendor/bin/php-cs-fixer fix
psalm:
vendor/bin/psalm
vendor/bin/psalm lib
npm-init:
npm ci

View File

@ -52,9 +52,14 @@ Memories is a _batteries-included_ photo management solution for Nextcloud with
1. ☁ Clone this into your `custom_apps` folder of your Nextcloud.
1. 📥 Install [Composer](https://getcomposer.org/) and [Node.js 18](https://nodejs.org)
1. 👩‍💻 In a terminal, run the command `make dev-setup` to install the dependencies.
1. 🏗 To build/watch the UI, run `make watch-js`. Lint-fix PHP with `make php-lint`.
1. 🏗 To build/watch the UI, run `make watch-js`.
1. ✅ Enable the app through the app management of your Nextcloud.
1. ⚒️ (Strongly recommended) use VS Code and install Vetur and Prettier.
1. ⚒️ (Strongly recommended) use VS Code for development and install these extensions.
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode): For autoformatting Vue and Typescript
- [PHP Intelephense](https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client): For PHP intellisense and static analysis
- [PHP-CS-Fixer](https://marketplace.visualstudio.com/items?itemName=muuvmuuv.vscode-just-php-cs-fixer): For PHP formatting (alternatively, `make php-cs-fixer`)
- [Psalm](https://marketplace.visualstudio.com/items?itemName=getpsalm.psalm-vscode-plugin): For PHP static analysis (alternatively, `make psalm`)
- [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur): For Vue intellisense and static analysis
## 🤝 Support the project

View File

@ -6,14 +6,25 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
cacheDirectory=".cache/psalm"
>
<projectFiles>
<directory name="lib" />
<!--
Duplication is due to differences in language server and CLI
The CLI needs the files in extraFiles since we specify lib as
the scan directory. The language server needs the files in
projectFiles since it doesn't seem to support extraFiles.
-->
<directory name="../../lib" />
<directory name="../../apps/files/lib/Event" />
<directory name="../../3rdparty/doctrine" />
<directory name="../../3rdparty/psr" />
<directory name="../../3rdparty/guzzlehttp" />
<ignoreFiles>
<!-- Careful to not exclude ourselves! -->
<directory name="../../lib" />
<directory name="../../apps/files" />
<directory name="../../3rdparty" />
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<extraFiles>
@ -22,7 +33,6 @@
<directory name="../../3rdparty/doctrine" />
<directory name="../../3rdparty/psr" />
<directory name="../../3rdparty/guzzlehttp" />
<directory name="../../3rdparty/doctrine" />
</extraFiles>
<issueHandlers>
<UndefinedDocblockClass>