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

Passed
Pull Request — master (#390)
by
unknown
15:37
created

ValidateCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.1481

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 6
cts 9
cp 0.6667
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.1481
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Command;
6
7
use GraphQL\Error\InvariantViolation;
8
use Overblog\GraphQLBundle\Resolver\TypeResolver;
9
use Symfony\Component\Console\Command\Command;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Input\InputOption;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
final class ValidateCommand extends Command
15
{
16
    use RequestExecutorLazyLoaderTrait;
17
18
    private $typeResolver;
19
20 1
    public function __construct(TypeResolver $typeResolver)
21
    {
22 1
        parent::__construct();
23 1
        $this->typeResolver = $typeResolver;
24 1
    }
25
26 1
    protected function configure(): void
27
    {
28
        $this
29 1
            ->setName('graphql:validate')
30 1
            ->setDescription('Validate schema')
31 1
            ->addOption(
32 1
                'schema',
33 1
                null,
34 1
                InputOption::VALUE_OPTIONAL,
35 1
                'The schema name to validate.'
36
            )
37
        ;
38 1
    }
39
40 1
    protected function execute(InputInterface $input, OutputInterface $output): void
41
    {
42 1
        $schemaName = $input->getOption('schema');
43 1
        $schema = $this->getRequestExecutor()->getSchema($schemaName);
44
45
        try {
46 1
            @$schema->assertValid();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
47
        } 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...
48
            $output->writeln('<comment>'.$e->getMessage().'</comment>');
49
50
            return;
51
        }
52 1
        $output->writeln('<info>No error</info>');
53 1
    }
54
}
55