runcmf/runtracy

View on GitHub

Showing 36 of 36 total issues

Function getServiceMap has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    private function getServiceMap()
    {
        $result = [
            'transport' => 'POST',
            'envelope' => 'JSON-RPC-2.0',
Severity: Minor
Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 5 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 getMemoryChart has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getMemoryChart()
    {
        $colors = [
            'axis' => '#000000',
            'gridLines' => '#cccccc',
Severity: Major
Found in src/RunTracy/Helpers/ProfilerPanel.php - About 4 hrs to fix

    Function validateCall has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        private function validateCall(\stdClass $call)
        {
            $result = null;
            $error = null;
            $data = null;
    Severity: Minor
    Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 4 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php
    /**
     * Copyright 2016 1f7.wizard@gmail.com
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Major
    Found in src/RunTracy/Helpers/SlimRequestPanel.php and 1 other location - About 4 hrs to fix
    src/RunTracy/Helpers/SlimResponsePanel.php on lines 1..54

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 142.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php
    /**
     * Copyright 2016 1f7.wizard@gmail.com
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Major
    Found in src/RunTracy/Helpers/SlimResponsePanel.php and 1 other location - About 4 hrs to fix
    src/RunTracy/Helpers/SlimRequestPanel.php on lines 1..54

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 142.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method __invoke has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __invoke(Request $request, Response $response, callable $next)
        {
            $res = $next($request, $response);
    
            $cookies = json_decode($request->getCookieParam('tracyPanelsEnabled'));
    Severity: Major
    Found in src/RunTracy/Middlewares/TracyMiddleware.php - About 3 hrs to fix

      Function completion has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function completion($token, $environment, $pattern)
          {
              $result = $this->initialize($token, $environment);
              if ($result) {
                  return $result;
      Severity: Minor
      Found in src/RunTracy/Helpers/Console/WebConsoleRPCServer.php - About 3 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              $this->icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 532 178" style="width: 35px"><path '.
                  'fill="#016301" d="m439 153.67c-13.839-3.3534-27.492-13.852-34.543-26.563-1.9832-3.575-4.8271-10.55-'.
                  '6.3198-15.5-2.4268-8.0476-2.7156-10.587-2.7288-24-0.0174-17.571 1.7519-25.761 8.271-38.287 7.21-13.853'.
                  ' 17.154-22.854 31.034-28.09 5.3616-2.0225 8.3741-2.4659 17.015-2.5047 9.3728-0.04211 11.552 0.31335 '.
                  '20.304 3.3111l9.8037 3.3582 3.3143-3.2123c2.7653-2.6803 3.9534-3.1596 7.1733-2.8941 5.9886 0.49386 '.
      Severity: Major
      Found in src/RunTracy/Helpers/TwigPanel.php and 1 other location - About 3 hrs to fix
      src/RunTracy/Helpers/SlimRouterPanel.php on lines 37..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              $this->icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 480" version="1.1" width="16px" '.
                  'height="16px"><path fill="#043CBF" d="m221.25 479.1c-79.88-6.85-150.37-51.83-189.99-121.24-14.666-'.
                  '25.69-23.972-53.8-29.552-89.27-0.70825-4.5-1.1632-16.11-1.1384-29.06 0.04489-23.34 1.5027-35.94 6.5464'.
                  '-56.54 14.241-58.18 49.919-109.05 99.764-142.23 30.47-20.29 60.66-31.962 98.61-38.123 10.115-1.6422 '.
                  '16.564-2.0339 34.042-2.0675 12.945-0.024869 24.56 0.43011 29.062 1.1385 35.467 5.5797 63.58 14.886 '.
      Severity: Major
      Found in src/RunTracy/Helpers/SlimRouterPanel.php and 1 other location - About 3 hrs to fix
      src/RunTracy/Helpers/TwigPanel.php on lines 36..69

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function __invoke has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __invoke(Request $request, Response $response, callable $next)
          {
              $res = $next($request, $response);
      
              $cookies = json_decode($request->getCookieParam('tracyPanelsEnabled'));
      Severity: Minor
      Found in src/RunTracy/Middlewares/TracyMiddleware.php - About 3 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

      File BaseJsonRpcServer.php has 316 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace RunTracy\Helpers\Console;
      
      /**
      Severity: Minor
      Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 3 hrs to fix

        Method getPanel has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getPanel()
            {
                $out = '
                <script>
                    function getSelectedTracyPanelCheckboxes() {
        Severity: Major
        Found in src/RunTracy/Helpers/PanelSelector.php - About 3 hrs to fix

          Method getPanel has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getPanel()
              {
                  $table = '
                  <style type="text/css">
                      .tracy-inner {
          Severity: Major
          Found in src/RunTracy/Helpers/ProfilerPanel.php - About 3 hrs to fix

            Method validateCall has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function validateCall(\stdClass $call)
                {
                    $result = null;
                    $error = null;
                    $data = null;
            Severity: Major
            Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 3 hrs to fix

              Function execute has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function execute()
                  {
                      $ret = [];
                      do {
                          // check for SMD Discovery request
              Severity: Minor
              Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.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 getServiceMap has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getServiceMap()
                  {
                      $result = [
                          'transport' => 'POST',
                          'envelope' => 'JSON-RPC-2.0',
              Severity: Major
              Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 2 hrs to fix

                Method getTab has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getTab()
                    {
                        $this->icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 532 178" style="width: 35px"><path '.
                            'fill="#016301" d="m439 153.67c-13.839-3.3534-27.492-13.852-34.543-26.563-1.9832-3.575-4.8271-10.55-'.
                            '6.3198-15.5-2.4268-8.0476-2.7156-10.587-2.7288-24-0.0174-17.571 1.7519-25.761 8.271-38.287 7.21-13.853'.
                Severity: Major
                Found in src/RunTracy/Helpers/TwigPanel.php - About 2 hrs to fix

                  Method completion has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function completion($token, $environment, $pattern)
                      {
                          $result = $this->initialize($token, $environment);
                          if ($result) {
                              return $result;
                  Severity: Minor
                  Found in src/RunTracy/Helpers/Console/WebConsoleRPCServer.php - About 1 hr to fix

                    Method getTab has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getTab()
                        {
                            // Set blinker to work with no active panel
                            $head = '
                            <style type="text/css">
                    Severity: Minor
                    Found in src/RunTracy/Helpers/ConsolePanel.php - About 1 hr to fix

                      Method execute has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function execute()
                          {
                              $ret = [];
                              do {
                                  // check for SMD Discovery request
                      Severity: Minor
                      Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language