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": [ "tasks": [
{ {
"type": "shell", "type": "shell",
"label": "phpstan 8.1 (watcher)", "label": "phpstan (watcher)",
"isBackground": true, "isBackground": true,
"problemMatcher": { "problemMatcher": {
"fileLocation": ["relative", "${workspaceRoot}"], "fileLocation": ["relative", "${workspaceRoot}"],
"owner": "phpstan-watcher-8.1", "owner": "phpstan-watcher",
"pattern": { "pattern": {
"regexp": "^/app/(.*?):([0-9\\?]*):(.*)$", "regexp": "^/app/(.*?):([0-9\\?]*):(.*)$",
"file": 1, "file": 1,

View File

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

View File

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

View File

@ -1,19 +1,12 @@
#!/bin/sh #!/bin/sh
PHP_VERSION="$1"
[ -z "$PHP_VERSION" ] && PHP_VERSION=8.1
echo PHP_VERSION: ${PHP_VERSION}
echo PWD: $(pwd)
while true; do while true; do
inotifywait . -e close_write -r -t 300 | grep -q .php && \ inotifywait . -e close_write -r -t 300 | grep -q .php && \
( (
MODIFIED=$(git ls-files -m | grep .php) MODIFIED=$(git ls-files -m | grep .php)
docker run --rm -v $(pwd):/app -v /tmp/phpstan-8.1:/tmp/phpstan \ 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=$?. echo All done, RC=$?.
) )
sleep 1 sleep 1