make phpstan & watcher happy, stop running phpstan on vendor/

This commit is contained in:
Andrew Dolgov 2023-10-20 21:22:03 +03:00
parent cdd7ad020e
commit 62ca093b75
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
4 changed files with 8 additions and 16 deletions

4
.vscode/tasks.json vendored
View File

@ -3,11 +3,11 @@
"tasks": [
{
"type": "shell",
"label": "phpstan 8.1 (watcher)",
"label": "phpstan (watcher)",
"isBackground": true,
"problemMatcher": {
"fileLocation": ["relative", "${workspaceRoot}"],
"owner": "phpstan-watcher-8.1",
"owner": "phpstan-watcher",
"pattern": {
"regexp": "^/app/(.*?):([0-9\\?]*):(.*)$",
"file": 1,

View File

@ -11,6 +11,8 @@ use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter;
class Tracer {
/** @var Tracer $instance */
private static $instance;
/** @var OpenTelemetry\API\Trace\TracerInterface $tracer */
private static $tracer;
public function __construct() {
@ -44,7 +46,7 @@ class Tracer {
* @param string $name
* @param array<string>|array<string, array<string, mixed>> $tags
* @param array<string> $args
* @return Span
* @return OpenTelemetry\API\Trace\SpanInterface
*/
private function _start(string $name, array $tags = [], array $args = []) {
$span = $this->tracer->spanBuilder($name)->startSpan();
@ -64,7 +66,7 @@ class Tracer {
* @param string $name
* @param array<string>|array<string, array<string, mixed>> $tags
* @param array<string> $args
* @return Span
* @return OpenTelemetry\API\Trace\SpanInterface
*/
public static function start(string $name, array $tags = [], array $args = []) {
return self::get_instance()->_start($name, $tags, $args);
@ -76,5 +78,4 @@ class Tracer {
return self::$instance;
}
}

View File

@ -28,8 +28,6 @@ parameters:
- plugins/**/tests/*
- plugins/*/vendor/intervention/*
- plugins/*/vendor/psr/log/*
- vendor/**/test/*
- vendor/**/tests/*
- vendor/sebastian/*
- vendor/**/*
paths:
- .

View File

@ -1,19 +1,12 @@
#!/bin/sh
PHP_VERSION="$1"
[ -z "$PHP_VERSION" ] && PHP_VERSION=8.1
echo PHP_VERSION: ${PHP_VERSION}
echo PWD: $(pwd)
while true; do
inotifywait . -e close_write -r -t 300 | grep -q .php && \
(
MODIFIED=$(git ls-files -m | grep .php)
docker run --rm -v $(pwd):/app -v /tmp/phpstan-8.1:/tmp/phpstan \
--workdir /app registry.fakecake.org/cthulhoo/ci-alpine:3.16 php81 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw analyze ${MODIFIED}
--workdir /app registry.fakecake.org/ci/php8.2-alpine:3.18 php82 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw analyze ${MODIFIED}
echo All done, RC=$?.
)
sleep 1