Passed
Push — master ( ea67ba...517615 )
by Nico
13:18
created

ELabFtwRuleset   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setTemplateResolver() 0 3 1
A __construct() 0 3 1
A getRules() 0 14 1
1
<?php declare(strict_types=1);
2
/**
3
 * @author Marcel Bolten <[email protected]>
4
 * @copyright 2023 Nicolas CARPi
5
 * @see https://www.elabftw.net Official website
6
 * @license AGPL-3.0
7
 * @package elabftw
8
 */
9
10
namespace FriendsOfTwig\Twigcs\Ruleset;
11
12
use FriendsOfTwig\Twigcs\RegEngine\RulesetBuilder;
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\RegEngine\RulesetBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use FriendsOfTwig\Twigcs\RegEngine\RulesetConfigurator;
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\RegEngine\RulesetConfigurator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use FriendsOfTwig\Twigcs\Rule;
15
use FriendsOfTwig\Twigcs\TemplateResolver\NullResolver;
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\TemplateResolver\NullResolver was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use FriendsOfTwig\Twigcs\TemplateResolver\TemplateResolverInterface;
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Tem...mplateResolverInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use FriendsOfTwig\Twigcs\Validator\Violation;
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Validator\Violation was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
/**
20
 * eLabFTW ruleset for twigcs
21
 */
22
class ELabFtwRuleset implements RulesetInterface, TemplateResolverAwareInterface
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Rul...eResolverAwareInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type FriendsOfTwig\Twigcs\Ruleset\RulesetInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
{
24
    private TemplateResolverInterface $resolver;
25
26
    public function __construct(private int $twigMajorVersion)
27
    {
28
        $this->resolver = new NullResolver();
29
    }
30
31
    public function getRules()
32
    {
33
        $configurator = new RulesetConfigurator();
34
        $configurator->setTwigMajorVersion($this->twigMajorVersion);
35
        $builder = new RulesetBuilder($configurator);
36
37
        return array(
38
            new Rule\ForbiddenFunctions(Violation::SEVERITY_ERROR, array('dump')),
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Rule\ForbiddenFunctions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
            // allow CamelCase, deactivate Rule\LowerCaseVariable
40
            //new Rule\LowerCaseVariable(Violation::SEVERITY_ERROR),
41
            new Rule\RegEngineRule(Violation::SEVERITY_ERROR, $builder->build()),
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Rule\RegEngineRule was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
            new Rule\TrailingSpace(Violation::SEVERITY_ERROR),
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Rule\TrailingSpace was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
            new Rule\UnusedMacro(Violation::SEVERITY_WARNING, $this->resolver),
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Rule\UnusedMacro was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
44
            new Rule\UnusedVariable(Violation::SEVERITY_WARNING, $this->resolver),
0 ignored issues
show
Bug introduced by
The type FriendsOfTwig\Twigcs\Rule\UnusedVariable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
45
        );
46
    }
47
48
    public function setTemplateResolver(TemplateResolverInterface $resolver): void
49
    {
50
        $this->resolver = $resolver;
51
    }
52
}
53