CPS-IT/handlebars

View on GitHub

Showing 9 of 13 total issues

Function resolveHelperFunction has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    protected function resolveHelperFunction($function): callable
    {
        // Try to resolve the Helper function in this order:
        //
        // 1. callable
Severity: Minor
Found in Classes/Traits/HandlebarsHelperTrait.php - About 2 hrs 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

Method resolveHelperFunction has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function resolveHelperFunction($function): callable
    {
        // Try to resolve the Helper function in this order:
        //
        // 1. callable
Severity: Minor
Found in Classes/Traits/HandlebarsHelperTrait.php - About 1 hr to fix

    Method validateConfiguration has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function validateConfiguration(array $configuration): void
        {
            if (!isset($configuration['controller']) || (string)$configuration['controller'] === '') {
                throw new \InvalidArgumentException(
                    sprintf('An extbase controller must be configured for the "%s" compatibility layer.', self::TYPE),

      Method getConfigTreeBuilder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getConfigTreeBuilder(): TreeBuilder
          {
              $treeBuilder = new TreeBuilder('handlebars');
              $rootNode = $treeBuilder->getRootNode();
      
      
      Severity: Minor
      Found in Classes/DependencyInjection/Extension/Configuration.php - About 1 hr to fix

        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                CacheInterface $cache,
                EventDispatcherInterface $eventDispatcher,
                TemplateResolverInterface $templateResolver,
                TemplateResolverInterface $partialResolver = null,
                array $defaultData = []
        Severity: Minor
        Found in Classes/Renderer/HandlebarsRenderer.php - About 35 mins to fix

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

              public function process(ContainerBuilder $container): void
              {
                  $container->registerForAutoconfiguration(DataProcessorInterface::class)->addTag($this->processorTagName);
          
                  foreach ($container->findTaggedServiceIds($this->processorTagName) as $id => $tags) {
          Severity: Minor
          Found in Classes/DependencyInjection/DataProcessorPass.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 resolveTemplatePath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function resolveTemplatePath(string $templatePath): string
              {
                  $filename = $templatePath;
                  foreach (array_reverse($this->templateRootPaths) as $templateRootPath) {
                      foreach ($this->supportedFileExtensions as $extension) {
          Severity: Minor
          Found in Classes/Renderer/Template/HandlebarsTemplateResolver.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 validateConfiguration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function validateConfiguration(array $configuration): void
              {
                  if (!isset($configuration['controller']) || (string)$configuration['controller'] === '') {
                      throw new \InvalidArgumentException(
                          sprintf('An extbase controller must be configured for the "%s" compatibility layer.', self::TYPE),

          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 $callable;
          Severity: Major
          Found in Classes/Traits/HandlebarsHelperTrait.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language