Skip to content

Commit

Permalink
test Qodana
Browse files Browse the repository at this point in the history
  • Loading branch information
DKravtsov committed Oct 17, 2023
1 parent c5c9eb5 commit 9a400ac
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ jobs:
run: make info
- name: Run test suite
run: make phpunit
- name: Archive coverage data for Qodana
uses: actions/upload-artifact@v3
with:
name: php-coverage-data
path: reports/clover.xml
- name: Run coding standard
run: make ecs
- name: Run codeSniffer
Expand Down Expand Up @@ -75,6 +80,11 @@ jobs:
php-version: '8.2'
- name: 'Install dependencies'
run: COMPOSER_MEMORY_LIMIT=-1 composer install
- name: 'Download coverage data for Qodana'
uses: actions/download-artifact@v3
with:
name: php-coverage-data
path: .qodana/code-coverage
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
Expand Down
1 change: 1 addition & 0 deletions docker-compose-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
container_name: ${COMPOSE_PROJECT_NAME}-symfony
volumes:
- ./.git:/var/www/html/.git:cached
- ./reports:/var/www/html/reports:delegated
depends_on:
- mysql
- rabbitmq
Expand Down
8 changes: 7 additions & 1 deletion qodana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ profile:
exclude:
- name: All
paths:
- reports
- reports/coverage
- reports/phpmetrics
- public/check.php
- src/General/Infrastructure/Service/ElasticsearchService.php
# - src/General/Domain/Doctrine/DBAL/Types/RealEnumType.php
# Delete excluding PhpCoverageInspection if you want to see code coverage report inside GitHub actions
- name: PhpCoverageInspection
- name: HttpUrlsUsage

php:
version: 8.2 #(Applied in CI/CD pipeline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Throwable;

use function preg_match;

Expand All @@ -35,6 +36,9 @@ public function supports(Request $request): ?bool
return $this->getToken($request) !== '';
}

/**
* @throws Throwable
*/
public function authenticate(Request $request): Passport
{
$token = $this->getToken($request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Throwable;

/**
* Class ApiKeyUserProvider
Expand All @@ -38,6 +39,9 @@ public function supportsClass(string $class): bool
return $class === ApiKeyUser::class;
}

/**
* @throws Throwable
*/
public function loadUserByIdentifier(string $identifier): ApiKeyUser
{
$apiKey = $this->getApiKeyForToken($identifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\ApiKey\Domain\Entity\ApiKey;
use App\ApiKey\Domain\Repository\Interfaces\ApiKeyRepositoryInterface;
use App\Role\Application\Security\RolesService;
use Throwable;

/**
* Interface ApiKeyUserProviderInterface
Expand All @@ -19,6 +20,8 @@ public function __construct(ApiKeyRepositoryInterface $apiKeyRepository, RolesSe

/**
* Method to fetch ApiKey entity for specified token.
*
* @throws Throwable
*/
public function getApiKeyForToken(string $token): ?ApiKey;
}
3 changes: 2 additions & 1 deletion src/General/Application/Decorator/StopwatchDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\General\Application\DTO\Interfaces\RestDtoInterface;
use App\General\Domain\Entity\Interfaces\EntityInterface;
use Closure;
use ProxyManager\Factory\AccessInterceptorValueHolderFactory;
use ReflectionClass;
use ReflectionMethod;
Expand Down Expand Up @@ -58,7 +59,7 @@ public function decorate(object $service): object
}

/**
* @return array{0: array<string, \Closure>, 1: array<string, \Closure>}
* @return array{0: array<string, Closure>, 1: array<string, Closure>}
*/
private function getPrefixAndSuffixInterceptors(ReflectionClass $class, string $className): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
use ArrayIterator;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\Exception\NotSupported;
use Doctrine\ORM\Exception\ORMException;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Doctrine\ORM\ORMInvalidArgumentException;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Tools\Pagination\Paginator;
Expand Down Expand Up @@ -95,6 +96,8 @@ public function findOneBy(array $criteria, ?array $orderBy = null, ?string $enti
/**
* {@inheritdoc}
*
* @throws NotSupported
*
* @psalm-return list<object|EntityInterface>
*/
public function findBy(
Expand Down
6 changes: 3 additions & 3 deletions src/General/Infrastructure/Service/ElasticsearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class ElasticsearchService implements ElasticsearchServiceInterface
* Constructor
*/
public function __construct(
private string $host,
private string $username,
private string $password,
private readonly string $host,
private readonly string $username,
private readonly string $password,
) {
$this->instantiate();
}
Expand Down
3 changes: 3 additions & 0 deletions src/User/Application/Security/UserTypeIdentification.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Doctrine\ORM\NonUniqueResultException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Throwable;

/**
* Class UserTypeIdentification
Expand All @@ -32,6 +33,8 @@ public function __construct(

/**
* Helper method to get current logged in ApiKey entity via token storage.
*
* @throws Throwable
*/
public function getApiKey(): ?ApiKey
{
Expand Down
3 changes: 3 additions & 0 deletions src/User/Transport/EventSubscriber/JWTCreatedSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\User\Application\Security\SecurityUser;
use DateTime;
use DateTimeZone;
use Exception;
use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent;
use Lexik\Bundle\JWTAuthenticationBundle\Events;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -86,6 +87,8 @@ private function setLocalizationData(array &$payload, UserInterface $user): void
* Method to set/modify JWT expiration date dynamically.
*
* @param array<string, string|int> $payload
*
* @throws Exception
*/
private function setExpiration(array &$payload): void
{
Expand Down

0 comments on commit 9a400ac

Please sign in to comment.