components-web-app/api-components-bundle

View on GitHub

Showing 100 of 108 total issues

Function convertVarToArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function convertVarToArray($var): void
    {
        if (\in_array($var, self::ARRAY_OUTPUT_VARS, true)) {
            /** @var iterable $choices */
            $choices = $this->vars[$var];
Severity: Minor
Found in src/Model/Form/FormView.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function applyToItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void
    {
        $configuration = $this->getConfiguration($resourceClass);

        if (!$configuration || !$this->requestStack->getCurrentRequest()) {
Severity: Minor
Found in src/Doctrine/Extension/ORM/PublishableExtension.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function publish has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function publish(Update $update): string
    {
        if ($update->getData() && $data = json_decode($update->getData(), true, 512, \JSON_THROW_ON_ERROR)) {
            try {
                $resource = $this->iriConverter->getResourceFromIri($data['@id']);
Severity: Minor
Found in src/Mercure/PublishableAwareHub.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getFilterQueries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFilterQueries(?array $filters, Expr $expr, QueryBuilder $queryBuilder): array
    {
        $filterQueries = [];
        if (null !== $filters) {
            foreach ($filters as $filterIndex => $filter) {
Severity: Minor
Found in src/Repository/Core/FileInfoRepository.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this method.
Open

            return;
Severity: Major
Found in src/Filter/OrSearchFilter.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return;
    Severity: Major
    Found in src/Filter/OrSearchFilter.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return;
      Severity: Major
      Found in src/Helper/ComponentPosition/ComponentPositionSortValueHelper.php - About 30 mins to fix

        Function loadClassMetadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
            {
                $reflectionClass = $classMetadata->getReflectionClass();
                $attributes = $reflectionClass->getAttributes(Publishable::class);
                if (!\count($attributes)) {
        Severity: Minor
        Found in src/Serializer/MappingLoader/PublishableLoader.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function findAttributeConfiguration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function findAttributeConfiguration($class, string $annotationClass): array
            {
                $reflection = new \ReflectionClass($class);
                $attributes = $reflection->getAttributes($annotationClass);
        
        
        Severity: Minor
        Found in src/AttributeReader/AttributeReader.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function getUrlPrefix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getUrlPrefix(string $url, string $headerName): string
            {
                $defaults = [
                    'host' => null,
                    'scheme' => null,
        Severity: Minor
        Found in src/Helper/RefererUrlResolver.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function create(string $resourceClass): ResourceMetadataCollection
            {
                $resourceMetadata = $this->decorated->create($resourceClass);
        
                $routePrefixParts = [];

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validate($componentPosition, Constraint $constraint): void
            {
                $collection = $componentPosition->componentGroup;
                if (!$collection) {
                    return;
        Severity: Minor
        Found in src/Validator/Constraints/ComponentPositionValidator.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function applyToCollection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
            {
                if (!$this->config || Route::class !== $resourceClass) {
                    return;
                }
        Severity: Minor
        Found in src/Doctrine/Extension/ORM/RouteExtension.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function getConfiguredProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getConfiguredProperties(object|string $data, bool $skipUploadableCheck = false): \Generator
            {
                if (!$skipUploadableCheck && !$this->isConfigured($data)) {
                    throw new UnsupportedAnnotationException(sprintf('Cannot get field configuration for %s: is it not configured as Uploadable', \is_string($data) ? $data : $data::class));
                }
        Severity: Minor
        Found in src/AttributeReader/UploadableAttributeReader.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function removeResources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function removeResources(OpenApi $openApi, array $resourceClassNames): void
            {
                $shortNames = $this->getResourceClassShortNames($resourceClassNames);
                $openApiPaths = $openApi->getPaths();
                $paths = $openApiPaths->getPaths();
        Severity: Minor
        Found in src/OpenApi/OpenApiFactory.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validate($password, Constraint $constraint): void
            {
                if (!$constraint instanceof UserPassword) {
                    throw new UnexpectedTypeException($constraint, UserPassword::class);
                }
        Severity: Minor
        Found in src/Validator/Constraints/UserPasswordValidator.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function checkMergeDraftIntoPublished has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function checkMergeDraftIntoPublished(Request $request, object $data, bool $flushDatabase = false): object
            {
                if (!$this->publishableStatusChecker->isActivePublishedAt($data)) {
                    return $data;
                }
        Severity: Minor
        Found in src/EventListener/Api/PublishableEventListener.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function addWhereByStrategy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive): void
            {
                $wrapCase = $this->createWrapCase($caseSensitive);
                $valueParameter = $queryNameGenerator->generateParameterName($field);
                switch ($strategy) {
        Severity: Minor
        Found in src/Filter/OrSearchFilter.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function normalize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function normalize($object, $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
            {
                $context[self::ALREADY_CALLED] = true;
        
                $finalRoute = $object;
        Severity: Minor
        Found in src/Serializer/Normalizer/RouteNormalizer.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function createFromRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createFromRequest(Request $request, bool $normalization, ?array $extractedAttributes = null): array
            {
                $context = $this->decorated->createFromRequest($request, $normalization, $extractedAttributes);
        
                if (
        Severity: Minor
        Found in src/Serializer/ContextBuilder/PublishableContextBuilder.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Severity
        Category
        Status
        Source
        Language