Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#390)
by
unknown
16:10
created

ValidateCommand::execute()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 0
cts 19
cp 0
rs 9.44
c 0
b 0
f 0
cc 4
nc 6
nop 2
crap 20
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Command;
6
7
use GraphQL\Error\InvariantViolation;
8
use GraphQL\Type\Schema;
9
use Overblog\GraphQLBundle\Resolver\TypeResolver;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Input\InputOption;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
final class ValidateCommand extends Command
16
{
17
    private $typeResolver;
18
19
    public function __construct(TypeResolver $typeResolver)
20
    {
21
        parent::__construct();
22
        $this->typeResolver = $typeResolver;
23
    }
24
25
    protected function configure(): void
26
    {
27
        $this
28
            ->setName('graphql:validate')
29
            ->setDescription('Validate schema')
30
            ->addOption(
31
                'schema',
32
                null,
33
                InputOption::VALUE_OPTIONAL,
34
                'The schema name to validate.'
35
            )
36
        ;
37
    }
38
39
    protected function execute(InputInterface $input, OutputInterface $output): void
40
    {
41
        $schemaName = $input->getOption('schema');
42
        $query = $this->typeResolver->resolve('Query');
43
        $mutation = null;
44
        $this->getRequestExecutor()->getSchema($schemaName);
45
        if ($this->typeResolver->hasSolution('Mutation')) {
46
            $mutation = $this->typeResolver->resolve('Mutation');
47
        }
48
49
        try {
50
            $schema = @new Schema([
51
                'query'    => $query,
52
                'mutation' => $mutation,
53
            ]);
54
        } catch (InvariantViolation $e) {
0 ignored issues
show
Bug introduced by
The class GraphQL\Error\InvariantViolation does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
55
            $output->writeln('<comment>'.$e->getMessage().'</comment>');
56
57
            return;
58
        }
59
60
        try {
61
            $schema->assertValid();
62
        } catch (InvariantViolation $e) {
0 ignored issues
show
Bug introduced by
The class GraphQL\Error\InvariantViolation does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
63
            $output->writeln('<comment>'.$e->getMessage().'</comment>');
64
65
            return;
66
        }
67
        $output->writeln('<info>No error</info>');
68
    }
69
}
70