From 08a51e821fbc54e7da3db9975d839fc251f8e043 Mon Sep 17 00:00:00 2001 From: byt3h3ad Date: Wed, 23 Nov 2022 11:47:06 +0530 Subject: [PATCH] feat: add analyzer --- .github/workflows/codeql-analysis.yml | 20 ++++++++ composer.json | 6 ++- composer.lock | 63 ++++++++++++++++++++++++- src/Orchestration/Adapter.php | 2 +- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/ .github/workflows/codeql-analysis.yml b/ .github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..734db04 --- /dev/null +++ b/ .github/workflows/codeql-analysis.yml @@ -0,0 +1,20 @@ +name: "CodeQL" + +on: [pull_request] +jobs: + lint: + name: CodeQL + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - run: git checkout HEAD^2 + + - name: Run CodeQL + run: | + docker run --rm -v $PWD:/app composer sh -c \ + "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file diff --git a/composer.json b/composer.json index 3b48244..a4bf8a7 100755 --- a/composer.json +++ b/composer.json @@ -11,12 +11,16 @@ "autoload-dev": { "psr-4": {"Utopia\\Tests\\": "tests/Orchestration"} }, + "scripts": { + "check": "./vendor/bin/phpstan analyse --level max src tests" + }, "require": { "php": ">=8.0", "utopia-php/cli": "0.14.*" }, "require-dev": { "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "vimeo/psalm": "4.0.1", + "phpstan/phpstan": "^1.9" } } diff --git a/composer.lock b/composer.lock index 2c2da90..a739ec7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f3062112fd350815d45e8600e4ddea7", + "content-hash": "bc5edd16b265d12c19def76faa6e6685", "packages": [ { "name": "utopia-php/cli", @@ -1191,6 +1191,65 @@ }, "time": "2022-10-14T12:47:21+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.9.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d6fdf01c53978b6429f1393ba4afeca39cc68afa", + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.9.2" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-11-10T09:56:11+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.18", @@ -3824,5 +3883,5 @@ "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/src/Orchestration/Adapter.php b/src/Orchestration/Adapter.php index 0a2ec26..0326ee0 100644 --- a/src/Orchestration/Adapter.php +++ b/src/Orchestration/Adapter.php @@ -88,7 +88,7 @@ abstract public function listNetworks(): array; * @param string $container * @param array $filters * - * @return array + * @return array */ abstract public function getStats(string $container = null, array $filters = []): array;