kylekatarnls/react

View on GitHub

Showing 5 of 16 total issues

Method elementToJs has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function elementToJs($element, $content, $indent = 0)
    {
        $name = $element->getName();
        if (in_array($name, $this->htmlTags)) {
            $name = json_encode($name);
Severity: Minor
Found in src/NodejsPhpFallback/ReactFallback.php - About 1 hr to fix

    Method compile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function compile()
        {
            $path = $this->getPath('source.jsx');
            if (!$this->lastFile) {
                $this->lastFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . preg_replace('/\.jsx$/i', '', basename($path)) . '.js';
    Severity: Minor
    Found in src/NodejsPhpFallback/React.php - About 1 hr to fix

      Function parseJsx has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parseJsx()
          {
              $this->result = '';
              $this->buffer = $this->source;
              while (mb_strlen($this->buffer)) {
      Severity: Minor
      Found in src/NodejsPhpFallback/ReactFallback.php - About 1 hr 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 elementToJs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function elementToJs($element, $content, $indent = 0)
          {
              $name = $element->getName();
              if (in_array($name, $this->htmlTags)) {
                  $name = json_encode($name);
      Severity: Minor
      Found in src/NodejsPhpFallback/ReactFallback.php - About 1 hr 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 parseJsx has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parseJsx()
          {
              $this->result = '';
              $this->buffer = $this->source;
              while (mb_strlen($this->buffer)) {
      Severity: Minor
      Found in src/NodejsPhpFallback/ReactFallback.php - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language