Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-4144 META: Code checker 1Q 2014 round
  3. CONTRIB-3562

Code-checker reports HTML-inside-PHP indentation as incorrect, when it is correct


    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3.5, 2.4.2
    • 2.1, 2.2
    • Local: Code checker
    • None

      I have been using the code-checker to help upgrade some previously-1.9 code to 2.x, and I have noticed that indentation is sometimes reported as incorrect when it is not (as far as I am aware).

      In the below (example) scenario, when breaking out of PHP to add a block of HTML, the codechecker suggests that lines 4 to 10 are incorrectly indented:

      01. <?php
      02. if (1=1) {
      03.     $somevar = true;
      04. ?>
      05. <div>
      06.     <p>
      07.         <span>some page content</span>
      08.     </p>
      09. </div>
      10. <?php
      11. }
      12. ?>

      The code-checker identifies line 3 as intented correctly, but then expects the PHP tags and HTML to be similarly indented, which I do not believe should be the case. Example error:

      472: Line indented incorrectly; expected at least 4 spaces, found 0

      I don't think that when breaking out of PHP into HTML the indentation should be maintained. Certainly this is not the case from many chunks of code I have seen: HTML maintains its own intentation, sometimes using two spaces instead of four, sometimes using no indentation at all.

            stronk7 Eloy Lafuente (stronk7)
            vaughany Paul Vaughan
            0 Vote for this issue
            3 Start watching this issue


                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.